Related item: prepopulate second field, not ID

rss

Posted by Katy - Dec 28 ’16 at 12:36

I hame a related item on Edit form done with these instructions:

http://formsdesigner.blogspot.com/2013/08/how-to-create-forms-with-related-items.html

And My ID is populating correctly without any issues. But i have another look up field from parent which i need to populate on new related item. How i can do that? I tryed fd.populateFields - no luck...

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 23 days
    #1 by Dmitry Kozlov Dec 29 ’16 at 12:22

    Hi Katy,

    If you're adding child items via a dialog, you can get parent's field values this way:

    window.top.fd.field('FieldName').value()

  • Katy
    Member
    Member for: 5 years 2 months 28 days
    #2 by Katy Dec 29 ’16 at 03:59

    [#1]:  May be i am not doing it right but this is not working. So let me explain once again:

    I have two lists: main wit WeekID and EmployeeType field and child which is connected to main by WeekID and the Type field is an added column (it is shown in the list like WeekID:EmployeeType) . Yes, i am adding new items via dialogue so on new item child list form i have the following code:

    var parentID = fd.getSourceID();


    if (parentID) {

     

    fd.field('WeekID').control().value(parentID);

     

    window.top.fd.field('WeekID_x003a_EmployeeType').value();


    $('.WeekID').hide();


    }

     

    WeekID - no problem with getting it, but WeekID:EmployeeType is just staying blank.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 23 days
    #3 by Dmitry Kozlov Dec 30 ’16 at 09:34

    [#2]: Hi Katy,

    Try to output the Type:

    alert(window.top.fd.field('WeekID_x003a_EmployeeType').value());

    what's the result. Is the Type field located and displayed in the parent form?

  • Katy
    Member
    Member for: 5 years 2 months 28 days
    #4 by Katy Jan 2 ’17 at 08:31

    [#3]: Thanks Dmitry. It gives "undefined" message.

  • Katy
    Member
    Member for: 5 years 2 months 28 days
    #5 by Katy Jan 2 ’17 at 08:35

    [#3]: And yes - 'EmployeeType' field from the parent list is also located on the form.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 23 days
    #6 by Dmitry Kozlov Jan 2 ’17 at 11:20

    [#5]: Hi,

    Please, try to output the following:

    alert(window.top.fd.field('WeekID_x003a_EmployeeType').control()._el().text());

  • Katy
    Member
    Member for: 5 years 2 months 28 days
    #7 by Katy Jan 2 ’17 at 11:27

    [#6]: Now the message is blank

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 23 days
    #8 by Dmitry Kozlov Jan 2 ’17 at 11:30

    [#7]: Are you sure that the field is not empty on the parent form? Could you provide HTML-source of the form? Drop it to [email protected]

  • Katy
    Member
    Member for: 5 years 2 months 28 days
    #9 by Katy Jan 2 ’17 at 11:49

    [#8]: Thanks, i sent it.

Displaying 1 to 9 of 9 messages

Related threads