Cross Site Lookup Add New Item

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

04 Apr 2014

Using the Cross SIte Lookup Add New Item feature how would I pass extra field values other than the ID to use in the destination form?


Thanks again.

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

06 Apr 2014

Hello,

You can retrieve any field value of the parent from the child via JavaScript if you open the child form in a dialog. The following code demonstrates how to get Title of the parent form:

Code: Select all

window.top.fd.field('Title').value()
You should put the code above into the child New form.

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

07 Apr 2014

Will this work if the Parent form is in Dialog?

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

08 Apr 2014

If you open the parent form in a dialog, please, try to put the following code into the child form:

Code: Select all

$('.ms-dlgFrame', window.top.document)[0]
.contentWindow.fd.field('Title').value()

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

08 Apr 2014

Great approach but I keep getting "Undefined" in the alert below no matter what field name I use???


var rate = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Title').value();
alert(rate);

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

08 Apr 2014

I found the answer. I was using the display form and needed to use the _el in the syntax. The current script works great from the edit form.


Thanks for all of your help!

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

01 May 2014

In the this thread you showed me how to get the dialog form that opens another form so we can get data from the initial form onto the new form. This is working great. Now we are opening an initial form in dialog, then a child form in dialog then creating a new form in dialog, maybe several layer deep. I do understand how to get each of the dialog forms, what I need help with is how to get the last dialog form opened before the current new form.


Thank you.

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

02 May 2014

If you have multiple dialogs opened at the same time, you can retrieve their content by index:

Code: Select all

$('.ms-dlgFrame', window.top.document)[index]
.contentWindow.fd.field('Title').value()

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

02 May 2014

I did find that but was looking for a way to detirmine how many are open or at lease the last one opened before the current one. Can I loop over a collection of them?


Thanks

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

06 May 2014

Getting the number of opened dialogs:

Code: Select all

$('.ms-dlgFrame', window.top.document).length
Loop over the list of dialogs:

Code: Select all

$('.ms-dlgFrame', window.top.document).each(function(i) {
   // 'i' is an index
   // 'this' is a document object 
});

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests