Page 1 of 2

Related item: prepopulate second field, not ID

Posted: 28 Dec 2016
by Katy
I hame a related item on Edit form done with these instructions:

http://spform.com/office-365/crea ... office-365

And My ID is populating correctly without any issues. But i have another look up field from parent which i need to populate on new related item. How i can do that? I tryed fd.populateFields - no luck...

Re: Related item: prepopulate second field, not ID

Posted: 29 Dec 2016
by Dmitry Kozlov
Hi Katy,

If you're adding child items via a dialog, you can get parent's field values this way:

window.top.fd.field('FieldName').value()

Re: Related item: prepopulate second field, not ID

Posted: 29 Dec 2016
by Katy
May be i am not doing it right but this is not working. So let me explain once again:

I have two lists: main wit WeekID and EmployeeType field and child which is connected to main by WeekID and the Type field is an added column (it is shown in the list like WeekID:EmployeeType) . Yes, i am adding new items via dialogue so on new item child list form i have the following code:

var parentID = fd.getSourceID();


if (parentID) {


fd.field('WeekID').control().value(parentID);


window.top.fd.field('WeekID_x003a_EmployeeType').value();


$('.WeekID').hide();


}


WeekID - no problem with getting it, but WeekID:EmployeeType is just staying blank.

Re: Related item: prepopulate second field, not ID

Posted: 30 Dec 2016
by Dmitry Kozlov
Hi Katy,

Try to output the Type:

alert(window.top.fd.field('WeekID_x003a_EmployeeType').value());

what's the result. Is the Type field located and displayed in the parent form?

Re: Related item: prepopulate second field, not ID

Posted: 02 Jan 2017
by Katy
Thanks Dmitry. It gives "undefined" message.

Re: Related item: prepopulate second field, not ID

Posted: 02 Jan 2017
by Katy
And yes - 'EmployeeType' field from the parent list is also located on the form.

Re: Related item: prepopulate second field, not ID

Posted: 02 Jan 2017
by Dmitry Kozlov
Hi,

Please, try to output the following:

alert(window.top.fd.field('WeekID_x003a_EmployeeType').control()._el().text());

Re: Related item: prepopulate second field, not ID

Posted: 02 Jan 2017
by Katy
Now the message is blank

Re: Related item: prepopulate second field, not ID

Posted: 02 Jan 2017
by Dmitry Kozlov
Are you sure that the field is not empty on the parent form? Could you provide HTML-source of the form? Drop it to support@spform.com.

Re: Related item: prepopulate second field, not ID

Posted: 02 Jan 2017
by Katy
Thanks, i sent it.