Hyperlink Functionality on AC and Lookup
- This topic has 1 reply, 2 voices, and was last updated 8 years, 1 month ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Home › Forums › Autocomplete › Hyperlink Functionality on AC and Lookup
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
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