I can't get these directions to work

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

28 Sep 2017

I don't mean to be critical but I have been attempting to follow these directions all day and I still can't get it to work.

https://spform.com/documentation/relate ... gular-mode

For example the instructions tell you to add this to the parent form's JS editor:

Code: Select all

fd.populateFieldsInGrid($('.related-items'), {
	Parent: '{CurrentItem}',
});
Why would I do this?


In the child's new form I am instructed to enter this:

Code: Select all

if (window != window.top && window.top.fd) {
  // the form is opened in a dialog from the parent form
  var parentId = parseInt(window.top.GetUrlKeyValue('ID'));
  if (parentId) {
    // the form is opened from the Edit form
    fd.field('Parent').value(parentId);
  } else {
    // the form is opened from the New form
    $('#_fd_parent_temp > input').val(window.top.fd._tempParentId());
  }
   
  $('.parent-field').hide();
}
Yet I can't get "window.top.GetUrlKeyValue('ID')" to return anything.
City of Nampa
Idaho
United States of America

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

28 Sep 2017

Correction I finally got "window.top.GetUrlKeyValue('ID')" to return a value.

I am about to set that value to the lookup field.
City of Nampa
Idaho
United States of America

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

28 Sep 2017

I got it to work but only when I completely abandoned the directions on this page and went with what I knew from previous use of Forms Designer.
City of Nampa
Idaho
United States of America

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

29 Sep 2017

Hello, Marion!
The instructions are given, so that this functionality will work on both New and Edit Forms. For Edit Forms, the process is easy since the item is already created and has an ID, it requires very little code to actually work.

The problem comes from the New Form - the Item has no ID yet, so it cannot be bound directly. That is why we store the temporary ID in the hidden field which gets populated once the item is saved. And that's also why you need all this extra code. Hope this makes sense. If you experience any issues, let us know - we'll do our best to help.

You can also follow our video step by step, it's the same as the text instruction, but shows you whole process from the beginning to the end, here - https://www.youtube.com/watch?v=rd8g6Zu1H_E
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests