Related Items - Pass Additonal Information

rss

Posted by Jeff Childers - Sep 4 ’13 at 07:15

In the past, I have used your examples to highjack the "New" button in order to pass various parameters via query string to a subform.

 

Now that you have a related items element in SPFORM, could you provide an example of how to pass and then access addiitonal parameters beyond just the list item ID to the new item form?

  • Hubbaroo
    Member
    Member for: 8 years 9 months 8 days
    #11 by Hubbaroo Oct 9 ’13 at 12:44

    [#10]: With 1 Related Items in the parent form I use the following code to pass additional information to the child's new form.

    // Put here the link to the specific New form and pass additional parameters:
    var cat = fd.field('Catagory').control().value()
    var newFormUrl = '/sites/resources/Lists/Contacts/NewForm.aspx?Catagory=' + cat;

    // Next 3 lines are required to open form in a dialog.
    var uri = new URI(newFormUrl);
    var url = uri.getLastPathSegment();
    g_useDialogAlwaysList.push(url.toLowerCase());

    // Here we replace the standard 'New item' link with our custom link:
    $('.ms-list-addnew a').attr('onclick', 'NewItem2(event, "' + newFormUrl + '");return false;');

     

    How would this work if we had a second, third or more Related Items and wanted to pass additional parameters? Help me understand how to detirmine what "Add new" was clicked from what Related Item.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 9 months 7 days
    #12 by Dmitry Kozlov Oct 11 ’13 at 12:44

    [#11]: Hello,

    You can select the specific one 'New link' by its index:

    $('.ms-list-addnew a').eq(1).attr('onclick', 'NewItem2(event, "' + newFormUrl + '");return false;');
  • William B. Wallace
    Member
    Member for: 1 month 26 days
    #13 by William B. Wallace May 2 ’22 at 12:18

    Cheap & affordable deals are available for deer decoy. Sportsman Finder is your source to find & compare deals from leading vendors. Check out your best hunting deals and shop from your trusted retailer. List of in-stock products for sale from top sellers: Palmetto, Foundry  Outdoor Tudor, Smith & Wesson. We save you time finding cheap hunting gear deals in stock. Improve your shooting accuracy with top-quality optics & scopes. Choose from a wide selection of products for all of your outdoor and tactical needs at Sportsman Finder.

  • William B. Wallace
    Member
    Member for: 1 month 26 days
    #14 by William B. Wallace May 2 ’22 at 12:18

    Cheap & affordable deals are available for deer decoy. Sportsman Finder is your source to find & compare deals from leading vendors. Check out your best hunting deals and shop from your trusted retailer. List of in-stock products for sale from top sellers: Palmetto, Foundry  Outdoor Tudor, Smith & Wesson. We save you time finding cheap hunting gear deals in stock. Improve your shooting accuracy with top-quality optics & scopes. Choose from a wide selection of products for all of your outdoor and tactical needs at Sportsman Finder.

Displaying 11 to 14 of 14 messages