Page 1 of 2
Related Items - Pass Additonal Information
Posted: 04 Sep 2013
by Jeff Childers
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?
Re: Related Items - Pass Additonal Information
Posted: 05 Sep 2013
by Dmitry Kozlov
Hello Jeff,
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;'
Re: Related Items - Pass Additonal Information
Posted: 20 Sep 2013
by Hubbaroo
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.
Re: Related Items - Pass Additonal Information
Posted: 21 Sep 2013
by Dmitry Kozlov
Hubbaroo, please, follow instructions from our article:
http://spform.com/office-365/crea ... office-365
Re: Related Items - Pass Additonal Information
Posted: 23 Sep 2013
by Hubbaroo
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();
}
Re: Related Items - Pass Additonal Information
Posted: 24 Sep 2013
by Dmitry Kozlov
Please, check if there are any javascript errors in your browser console. Make sure that 'Textfield' is internal name of your field.
Re: Related Items - Pass Additonal Information
Posted: 24 Sep 2013
by Hubbaroo
I was using the wrong name. I looked up the internal name and now it works. Thank you.
Re: Related Items - Pass Additonal Information
Posted: 08 Oct 2013
by Hubbaroo
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???
Re: Related Items - Pass Additonal Information
Posted: 08 Oct 2013
by Hubbaroo
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());
Re: Related Items - Pass Additonal Information
Posted: 09 Oct 2013
by Dmitry Kozlov
To get value of the field in Display form, please, use the following code:
Code: Select all
fd.field('InternalName').control()._el().text()