Related Items - Pass Additonal Information

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
User avatar
Jeff Childers
Posts: 18
Joined: Sun May 25, 2014

04 Sep 2013

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?

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

05 Sep 2013

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;'

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

20 Sep 2013

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.

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

21 Sep 2013

Hubbaroo, please, follow instructions from our article:
http://spform.com/office-365/crea ... office-365

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

23 Sep 2013

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();
}

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

24 Sep 2013

Please, check if there are any javascript errors in your browser console. Make sure that 'Textfield' is internal name of your field.

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

24 Sep 2013

I was using the wrong name. I looked up the internal name and now it works. Thank you.

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

08 Oct 2013

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???

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

08 Oct 2013

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());

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

09 Oct 2013

To get value of the field in Display form, please, use the following code:

Code: Select all

fd.field('InternalName').control()._el().text()

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests