Related Items - Pass Additonal Information

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

09 Oct 2013

Perfect. Thank you

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

09 Oct 2013

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

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

11 Oct 2013

Hello,

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

Code: Select all

$('.ms-list-addnew a').eq(1).attr('onclick', 'NewItem2(event, "' + newFormUrl + '");return false;');

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests