Page 1 of 2

openForm syntax

Posted: 12 Jun 2014
by schuess
What is the proper syntax if I want to use openForm(filename, queryParams) and pass an ID as a query param?


fd.openForm('fd_meetingMinutes_DisplayForm.aspx', ID:9);

fd.openForm('fd_meetingMinutes_DisplayForm.aspx', 9);

With ID as variable: fd.openForm('fd_meetingMinutes_DisplayForm.aspx', ID: myID);


What components are necessary to open a DisplayForm from a different list? and what would the syntax look like?


*Note: the two forms are in different lists!

Re: openForm syntax

Posted: 12 Jun 2014
by eedoh
var CRID = 1;//or some other way of getting the id for your list item
fd.openForm('path to the list/list name/DispForm.aspx',{ID:CRID, Source:document.URL});

So to sum up:

1. if the form is on another list, don't forget to specify path to the list (relative, or absolute)
2. I doubt your form is named "fd_meetingMinutes_DisplayForm.aspx", It's probably something like "fd_Item_3205351f-1848-4d32-99da-37fde391ec26_Display.aspx", but you can use generic Sharepoint name "DispForm.aspx", and let forms designer open correct form based on user privileges
3. put your parameters into {}. Separate them with "," if there's more than one

Here's an example:
fd.openForm('../Cost Record Log/EditForm.aspx',{ID:CRID, Source:document.URL});
}

Re: openForm syntax

Posted: 12 Jun 2014
by Dmitry Kozlov
Hi,

Please, specify application-relative URL of your form and pass ID in the object:

fd.openForm('/Lists/Custom/DispForm.aspx', {ID: 17})

Open form in a dialog:

fd.openFormInDialog('/Lists/Custom/DispForm.aspx', {ID: 17})

Re: openForm syntax

Posted: 12 Jun 2014
by schuess
You are a Rock Star! Thank you.


My working code:


window.myFunc = function(){


var myID = fd.field('idOfMM').control()._el().text();
var mySource = "https%3A%2F%2Fprivacy%2Esharepoint%2Ecom%2Fsites%2Fmgh%2FLists%2FMeeting%2520Minutes%2FAllItems%2Easpx"

fd.openForm('/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx', {ID:myID, Source:mySource});
}

Re: openForm syntax

Posted: 13 Jun 2014
by schuess
Randomly i start getting this error


Sorry, something went wrong
No item exists at https://private.sharepoint.com/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx?FDSource=https://private.sharepoint.com/sites/mg ... c2bc643d5a. It may have been deleted or renamed by another user.


which is not true.

Re: openForm syntax

Posted: 15 Jun 2014
by Dmitry Kozlov
It seems you didn't pass the ID, I don't see it in your URL. Please, make sure that myID is not empty in your code:

fd.openForm('/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx', {ID:myID, Source:mySource}); }

Re: openForm syntax

Posted: 16 Jun 2014
by schuess
I verified with an alert, and received the same error


No item exists at https://hidden.sharepoint.com/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx?FDSource=https://hiddenforprivacy.sharepoint.com ... c2bc643d5a. It may have been deleted or renamed by another user.

Re: openForm syntax

Posted: 16 Jun 2014
by schuess
Where should the source come from? This list I am in, or the list of the new form i want to open?

Re: openForm syntax

Posted: 16 Jun 2014
by schuess
No item exists at https://private.sharepoint.com/sites/mg ... c2bc643d5a. It may have been deleted or renamed by another user.

Re: openForm syntax

Posted: 17 Jun 2014
by Dmitry Kozlov
Please, try to omit Source parameter, pass ID only:

fd.openForm('/sites/mgh/Lists/Meeting Minutes/fd_meetingMinutes_DisplayForm.aspx', {ID:myID});