I am developing a custom copy item form for Sharepoint 2013. I have created a copy button for my list items so that the user can easily copy items. I put a button in list view form ribbon for this. Currently, that button is only opening the form in page mode, but I need to provide standard Sharepoint behavior when the "Launch forms in a dialog?" list setting is set to "Yes". In other words, if the user sets this to true, my form should open in a modal dialog.
Here is my JS code:
var siteColUrl = _spPageContextInfo.siteAbsoluteUrl; var options = SP.UI.$create_DialogOptions(); window.location = siteColUrl + '/Lists/Activities/NewForm.aspx?CopyItemID=' + listItemId;
The problem here is obviously
window.location but I don't know what to put there. My search efforts brought nothing, so can anyone help me out here?
EDIT: If the user sets the "Launch forms in a dialog?" to "No", the form should be opened like a normal page. I know how to open forms in a dialog with JS, but I don't know how to check what the list setting is. Preferably, I could also use a SP JS function that does the handling for me, if anything like that even exists.