spjs-lookup ID Value

Forums SPJS-Lookup spjs-lookup ID Value

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 1 month ago.

  • Author
    Posts
  • #23281

    Bob Hornak
    Participant

    Hi Alexander,
    How can I retrieve the corresponding ID for the item selected with spjs-lookup?

    Thanks

  • #23285

    Alexander Bautz
    Keymaster

    Hi,
    If you inspect the <option> of the <select> you will find the value attribute has the ID of the list item.

    You would have to use custom code (for example in dffs_PreSaveAction) to get the ID and write it to another field. You should be able to use code like this (written directly here so I haven’t tested it):

    var selectedID = jQuery("#dffs_YourFieldInternalNameHere select").val();
    setFieldValue("TheFieldYouWantToSaveTheIdIn",selectedID);

    Alexander

You must be logged in to reply to this topic.