Related Items - Pass Additonal Information
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
// 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
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello,
You can select the specific one 'New link' by its index:
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;');
-
- Information
-
Who is online
Users browsing this forum: No registered users and 15 guests