0

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.

2
  • So you are asking what JS to use to open a modal form instead of just using 'window.location' to force navigation?
    – John-M
    Sep 22, 2015 at 17:47
  • partly. if the user sets the "Launch forms in a dialog?" to "No", then the form should not be displayed in a dialog but as a normal page. Sep 22, 2015 at 17:49

1 Answer 1

1

Right now (September 2015) there is no property in the CSOM (Javascript or C#) or REST API to check if a list is set to display forms in a dialog.

The server side object model version of this property (on SPList objects) is called NavigateForFormsPages -- unfortunately it just doesn't exist on the CSOM SP.List objects.

I even checked the SchemaXml property of the list, which can have some other properties not exposed in the client APIs but didn't see anything there either.

You could use some other value that you can read and write with REST/CSOM but it wouldn't automatically update itself based on if a list had checked show forms in modal dialog or not.

1
  • ctx object in SP has an attribute called NavigateForFormsPages too, though it seems it's only available in a list view as it's undefined when I try to access it from a list form. Sep 25, 2015 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.