Page 1 of 1

Related Items when parent is opened in Dialog

Posted: 09 May 2019
by andyb
Hi, I've been looking at https://spform.com/related-items/creati ... ms-control

In it, it outlines how to use a standard new form in the related items control to add new items, which works fine when my parent form is opened in a page, however, in some cases the parent form will be opened as a dialog. If this is the case, the code does not seem to populate the lookup field in the 'child' item.

Is there some way I can get this to work when my parent form is a dialog? I considered changing the reference of window.top to window.parent but that seems to make no difference and still fails to populate the lookup field.

Hopefully this makes sense! Please let me know if you need further information. I am using SharePoint 2013 server and Forms Designer 3.1.4.

Thanks
Andy

EDIT - I think I fixed it by adding this into the new form and setting the lookup field with parentId:

var parentId = $('.ms-dlgFrame', window.top.document)[0]
.contentWindow.GetUrlKeyValue('ID');

But please tell me if I'm doing this wrong! :)

Re: Related Items when parent is opened in Dialog

Posted: 09 May 2019
by AlexZver
Dear Andy,

Please refer to more fresh documentation here: https://spform.com/documentation/relate ... gular-mode