Related Items - Pass Additonal Information
- Jeff Childers
- Posts: 18
- Joined: Sun May 25, 2014
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?
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?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello Jeff,
Please use the following js-code to open the specific New form of your related list and to pass additional parameters:
Please use the following js-code to open the specific New form of your related list and to pass additional parameters:
Code: Select all
// Put here the link to the specific New form and pass additional parameters ('test' in my case):
var newFormUrl = '/sites/spform/Lists/Countries/NewForm.aspx?test=1';
// 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;'
I have the parent form with the related items control workibng to create a related item in the child list. We need to set a choice field in the child form based on a selection on the parent form. So far I have tried using the information here but no luck.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hubbaroo, please, follow instructions from our article:
http://spform.com/office-365/crea ... office-365
http://spform.com/office-365/crea ... office-365
We have the related creating as expected but can't seem to get any other fields to populate on the related items form. Even if I try to set the value of a text field with the following, only the Company field get the ID, the Textfield gets nothing.
var parentID = fd.getSourceID()
fd.field('Textfield').control().value("Hello")
if (parentID) {
fd.field('Company').control().value(parentID);
$('.company-field').hide();
}
var parentID = fd.getSourceID()
fd.field('Textfield').control().value("Hello")
if (parentID) {
fd.field('Company').control().value(parentID);
$('.company-field').hide();
}
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Please, check if there are any javascript errors in your browser console. Make sure that 'Textfield' is internal name of your field.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
To get value of the field in Display form, please, use the following code:
Code: Select all
fd.field('InternalName').control()._el().text()
-
- Information
-
Who is online
Users browsing this forum: No registered users and 21 guests