Related Items - Pass Additonal Information
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?
-
DmitryAdminMember for: 11 years 3 months 13 days
Hello Jeff,
Please use the following js-code to open the specific New form of your related list and to pass additional parameters:
// 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;');
-
HubbarooMemberMember for: 10 years 2 days
[#1]: 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 KozlovAdminMember for: 10 years 1 day
[#2]: Hubbaroo, please, follow instructions from our article:
http://formsdesigner.blogspot.com/2013/08/how-to-create-forms-with-related-items.html -
HubbarooMemberMember for: 10 years 2 days
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();
} -
Dmitry KozlovAdminMember for: 10 years 1 day
[#4]: Please, check if there are any javascript errors in your browser console. Make sure that 'Textfield' is internal name of your field.
-
HubbarooMemberMember for: 10 years 2 days
[#5]: I was using the wrong name. I looked up the internal name and now it works. Thank you.
-
HubbarooMemberMember for: 10 years 2 days
[#1]: If I wanted to pas a value from a field on the display form how would I referance that value. In the edit form I can set an alert to display the value but in the display form I jet get undifined returned???
-
HubbarooMemberMember for: 10 years 2 days
[#7]: This works on the edit form load but returns undefined on the display form load?? This is a choice field with 3 values.
alert(fd.field('Catagory').control().value());
-
Dmitry KozlovAdminMember for: 10 years 1 day
[#8]: To get value of the field in Display form, please, use the following code:
fd.field('InternalName').control()._el().text()
-
HubbarooMemberMember for: 10 years 2 days
[#9]: Perfect. Thank you