Page 1 of 1

Confusion with related items

Posted: 18 Aug 2016
by Alexey Babin
I've faced to such problem: I'm using related items list in non-grid mode. And I need to be able to add new children on NEW parent's form (for new parent) and on EDIT parent's form (for existing parent). The parent's ID translation from Parens form provided by JS code on children's NEW form. The code is


$('#_fd_parent_temp > input').val(window.top.fd._tempParentId()); //This part for create new item from NEW parent
//this code for create new child for existing item via EDIT form.

var parentID = fd.getSourceID();
if (parentID) {
fd.field('ParentId').control().value(parentID);
}


So the problem is in ListView of related items, that is placed at Parent's NEW form. It appears when: 1. I create new parent (a.e. with ID = 1) (with or without children - at this moment it does not make sense) 2. I open existing parent (with ID = 1) 3. I add another children to this parent, save it, and close Edit form 4. I open new parent form, and see on the blank form previously created children (that has ParentID = 1) 5. ParentID of children described in previous point changes to 1. This probem disappear when I clear browser cookies after editing parent item, but it's not the case for users.

Re: Confusion with related items

Posted: 19 Aug 2016
by Dmitry Kozlov
Hi Alex,

Try to add the condition into the child form:

Code: Select all

if (window.top.fd._formType() == 'New') {
    $('#_fd_parent_temp > input').val(window.top.fd._tempParentId());
} else {
    var parentID = fd.getSourceID();
    if (parentID) {
        fd.field('ParentId').control().value(parentID);
    }
}

Re: Confusion with related items

Posted: 19 Aug 2016
by Alexey Babin
Thanks a lot! Now works great!