Page 1 of 1

Cross Site Lookup Add New Item

Posted: 04 Apr 2014
by Hubbaroo
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.

Re: Cross Site Lookup Add New Item

Posted: 06 Apr 2014
by Dmitry Kozlov
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.

Re: Cross Site Lookup Add New Item

Posted: 07 Apr 2014
by Hubbaroo
Will this work if the Parent form is in Dialog?

Re: Cross Site Lookup Add New Item

Posted: 08 Apr 2014
by Dmitry Kozlov
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()

Re: Cross Site Lookup Add New Item

Posted: 08 Apr 2014
by Hubbaroo
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);

Re: Cross Site Lookup Add New Item

Posted: 08 Apr 2014
by Hubbaroo
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!

Re: Cross Site Lookup Add New Item

Posted: 01 May 2014
by Hubbaroo
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.

Re: Cross Site Lookup Add New Item

Posted: 02 May 2014
by Dmitry Kozlov
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()

Re: Cross Site Lookup Add New Item

Posted: 02 May 2014
by Hubbaroo
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

Re: Cross Site Lookup Add New Item

Posted: 06 May 2014
by Dmitry Kozlov
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 
});