How to reference Cross-Site Lookup field

rss

Posted by MES5464 - Sep 3 ’13 at 03:52

How do you reference a cross-site lookup field for: Get Text, Get ID, Set Text, Set ID, OnChange?

  • Dmitry
    Dmitry
    Admin
    Member for: 11 years 3 months 13 days
    #1 by Dmitry Sep 3 ’13 at 11:56

    We are working on JS-framework and soon you will be able to use all of these methods. But currently you can just get or set id with value() method and handle 'change' event with change() method.

  • Dmitry
    Dmitry
    Admin
    Member for: 11 years 3 months 13 days
    #2 by Dmitry Sep 19 ’13 at 09:07

    We have updated our article with additional samples of working with Cross-site Lookup via JavaScript:
    http://formsdesigner.blogspot.com/2013/04/getting-and-setting-sharepoint-form.html

  • MES5464
    Member
    Member for: 10 years 27 days
    #3 by MES5464 Sep 19 ’13 at 12:27

    Can you tell me what I am doing wrong?

    Here is my code:

    function buildTitle(){

    var nam = fd.field('Personnel').control('data')['Title'];

    var bd = new Date(fd.field('Begin_x0020_Date').control().value());

    var ed = new Date(fd.field('End_x0020_Date').control().value());

     

    bdd = bd.getDate();

    bmm = bd.getMonth() + 1;

    byy = bd.getFullYear();

     

    edd = ed.getDate();

    emm = ed.getMonth() + 1;

    eyy = ed.getFullYear();

     

    fd.field('Title').control().value(name + ' [' + bmm + '/' + bdd + '/' + byy + ' - ' + emm + '/' + edd + '/' + eyy + ']');

     

    }

     

    fd.field('Personnel').control().change(function(){

    buildTitle();

    });

     

    fd.field('Begin_x0020_Date').control().change(function(){

    buildTitle();

    });

     

    fd.field('End_x0020_Date').control().change(function(){

    buildTitle();

    });

    The output I get from the function doesn't include the Personnel name.
  • MES5464
    Member
    Member for: 10 years 27 days
    #4 by MES5464 Sep 19 ’13 at 12:50

    I miss quoted the line:

    fd.field('Title').control().value(nam + ' [' + bmm + '/' + bdd + '/' + byy + ' - ' + emm + '/' + edd + '/' + eyy + ']');

     

    Now, the results I get are:

    undefined [8/17/2013 - 8/19/2013]

  • Dmitry
    Dmitry
    Admin
    Member for: 11 years 3 months 13 days
    #5 by Dmitry Sep 20 ’13 at 03:48

    [#4]: Hello,

    You have  to use the internal name of the field from the linked list instead of 'Title'. In you case the internal name is 'Full_x0020_Name'. So, try the following code:

    fd.field('Personnel').control('data')['Full_x0020_Name']

     

  • peter0900
    Member
    Member for: 10 months 13 days
    #6 by peter0900 Jun 9 ’23 at 06:04

    Referencing a Cross-Site Lookup field needs identifying the source list and using the right lookup syntax.

    Transportation Company Services in Las Vegas NV

     

     

  • Rowan943
    Member
    Member for: 4 months 9 days
    #7 by Rowan943 Jun 10 ’23 at 03:33

    [#6]: The size and weight of the vehicle are crucial factors as well. Larger and heavier vehicles take up more space on the shipping vessel and may require specialized equipment for loading and unloading. https://www.youtube.com/watch?v=MG2nIU5UIPc

Displaying 1 to 7 of 7 messages