Get ID from a lookup field in DispForm.aspx

Forums General discussion Get ID from a lookup field in DispForm.aspx

Viewing 1 reply thread
  • Author
    Posts
    • #26835
      Taylor Scott
      Participant

      Hi Alex,

      When I’m in new or edit, and I want to get the ID of a lookup field I can use
      $(‘#dffs_FIN option:selected’).val() or $(‘#dffs_FIN select’).val()

      When it’s in dispform.aspx I can’t use this and getFieldValue(fin) only gives me the lookup value not the ID. Is there a simple way to get the ID that I’m just missing?

    • #26837
      Alexander Bautz
      Keymaster

      You can use this snippet to get the ID from a single choice lookup in DispForm:

      var lookupId = GetUrlKeyValue("ID",false,jQuery("#dffs_LookupProject .ms-formbody a").attr("href"));
      alert(lookupId);

      Replace LookupProject with your field internal name.

      Alexander

Viewing 1 reply thread
  • You must be logged in to reply to this topic.