openForm syntax

rss

Posted by schuess - Jun 12 ’14 at 08:50

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!

  • eedoh
    Member
    Member for: 7 years 11 months 21 days
    #1 by eedoh Jun 12 ’14 at 09:35

    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});
    }

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 4 months 2 days
    #2 by Dmitry Kozlov Jun 12 ’14 at 09:42

    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})

  • schuess
    schuess
    Member
    Member for: 7 years 11 months 28 days
    #3 by schuess Jun 12 ’14 at 09:47

    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});
    }

  • schuess
    schuess
    Member
    Member for: 7 years 11 months 28 days
    #4 by schuess Jun 13 ’14 at 08:37

    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/mgh/Lists/Calendar/fd_meeting_DisplayForm.aspx?List=981bff8b%252D6a71%252D4c2b%252Dade6%252Ddd327dc0f465&ID=26&Web=7911e323%252D7336%252D44b7%252D8543%252Ddfc2bc643d5a&Source=https://private.sharepoint.com/sites/mgh/Lists/Calendar/fd_meeting_DisplayForm.aspx?List=981bff8b%252D6a71%252D4c2b%252Dade6%252Ddd327dc0f465&ID=26&Web=7911e323%252D7336%252D44b7%252D8543%252Ddfc2bc643d5a&List=981bff8b-6a71-4c2b-ade6-dd327dc0f465&ID=20&Web=7911e323-7336-44b7-8543-dfc2bc643d5a.  It may have been deleted or renamed by another user.

     

    which is not true.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 4 months 2 days
    #5 by Dmitry Kozlov Jun 15 ’14 at 07:48

    [#4]: 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}); }

  • schuess
    schuess
    Member
    Member for: 7 years 11 months 28 days
    #6 by schuess Jun 16 ’14 at 11:19

    [#5]: 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/sites/mgh/Lists/Calendar/fd_meeting_DisplayForm.aspx?List=981bff8b%252D6a71%252D4c2b%252Dade6%252Ddd327dc0f465&ID=32&Web=7911e323%252D7336%252D44b7%252D8543%252Ddfc2bc643d5a&Source=https%253A%252F%252Fhidden%252Esharepoint%252Ecom%252Fsites%252Fmgh%252FLists%252FMeeting%252520Minutes%252FAllItems%252Easpx&List=981bff8b-6a71-4c2b-ade6-dd327dc0f465&ID=27&Web=7911e323-7336-44b7-8543-dfc2bc643d5a.  It may have been deleted or renamed by another user.

     

     

  • schuess
    schuess
    Member
    Member for: 7 years 11 months 28 days
    #7 by schuess Jun 16 ’14 at 11:28

    [#6]: Where should the source come from? This list I am in, or the list of the new form i want to open?

  • schuess
    schuess
    Member
    Member for: 7 years 11 months 28 days
    #8 by schuess Jun 16 ’14 at 12:41
  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 4 months 2 days
    #9 by Dmitry Kozlov Jun 17 ’14 at 02:40

    [#8]: Please, try to omit Source parameter, pass ID only:

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

  • schuess
    schuess
    Member
    Member for: 7 years 11 months 28 days
    #10 by schuess Jun 17 ’14 at 08:30

    [#9]: Tried that. No luck

     

    No item exists at https://private.sharepoint.com/sites/mgh/Lists/MeetingMinutes/fd_meetingMinutes_DisplayForm.aspx?FDSource=https://private.sharepoint.com/sites/mgh/Lists/Calendar/fd_meeting_DisplayForm.aspx?List=981bff8b%252D6a71%252D4c2b%252Dade6%252Ddd327dc0f465&ID=34&Web=7911e323%252D7336%252D44b7%252D8543%252Ddfc2bc643d5a&Source=https://private.sharepoint.com/sites/mgh/Lists/Calendar/fd_meeting_DisplayForm.aspx?List=981bff8b%252D6a71%252D4c2b%252Dade6%252Ddd327dc0f465&ID=34&Web=7911e323%252D7336%252D44b7%252D8543%252Ddfc2bc643d5a&List=981bff8b-6a71-4c2b-ade6-dd327dc0f465&ID=2&Web=7911e323-7336-44b7-8543-dfc2bc643d5a.  It may have been deleted or renamed by another user.

Displaying 1 to 10 of 11 messages
Previous12