Hyperlink Functionality on AC and Lookup

Home Forums Autocomplete Hyperlink Functionality on AC and Lookup

Viewing 1 reply thread
  • Author
    Posts
    • #22478
      Wilson
      Participant

        Hi Alexander,
        I replaced many of the native SP lookup fields with SPJS-AC and SPJS-Lookup controls for various reasons, However I would like to restore the “hyperlink” functionality that you lose on the list view.
        For example…
        1) “List A” has an SPJS-AC column to lookup CustomerName from CustomerAccount list
        2) I also set the CustomerAccountID (SPID Field from CustomerAccount list) using the “Set Fields” function of SPJS-AC (So i have the item id of the item I would to open)
        3) From “List A” list view, I would like to be able to Click on CustomerName and open a Modal popup Display form for that customer (SP.UI.ModalDialog.showModalDialog(options)), just as you would get if you use native SP Lookup column.

        Any thoughts?
        Thanks,
        Wilson

      • #22498
        Alexander Bautz
        Keymaster

          Hi,
          The best I can think of is that you write the URL to a Hyperlink field. You can do it like this in the Custom JS by specifying a parseFunction in your spjs.ac.textField function call:

          spjs.ac.textField({
              "applyTo":"projectField",
              "helpText":"Start typing to search...",
              ...
              ...
              ...
              "setFields":[{
               "fromFIN":["ID","Title"],
               "joinBy":"",
               "toFIN":"MyHyperlinkField",
               "parseFunction":"writeHyperlink",
               "skipIfEmpty":false
              }]
          });
          
          function writeHyperlink(a){
              return [_spPageContextInfo.webAbsoluteUrl + "/Lists/ProjectList/DispForm.aspx?ID=" + a[0], a[1]];
          }

          Change the list name to match yours in the URL.

          Unfortunately you cannot have it open in a new window / tab, and not in a dialog box either because the built in Hyperlink field doesn’t support that.

          Alexander

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