How can I include a hyperlink a show field message?

sola2
Tera Contributor

I am making a catalog item, one of the variables is a multible choice question. What i want to archieve is if the user selects "no" then to show a field message indicating the user they should go to this link https://www.criminalrecords.govt.nz this must be a Hyperlink (open in new tab)

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

This is more straight-forward if you can use an info message or error message (at the top of the form) you can use a line like this:

g_form.addInfoMessage("Please <a href = '/incident_list.do'>Click</a>");
g_form.addErrorMessage("Please <a href = '/incident_list.do'>Click</a>");

If you need this to be a field message, and are not opposed to using the verboten DOM, then code like this will work in a Client Script with the Isolate script box unchecked:

var str = "";
var placeholder = "##placeholder##";
g_form.showFieldMsg('v_mc', placeholder, 'info', false); //variable name
str = this.document.getElementsByClassName("fieldmsg notification notification-info")[0].innerHTML;
str = str.substring (0, str.indexOf(placeholder));
this.document.getElementsByClassName('fieldmsg notification notification-info')[0].innerHTML = str + "Please <a href='http://www.ibm.com' target = '_blank'>Click here</a> for more information.";

where 'v_mc' is the name of the variable in this example.

View solution in original post

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

This is more straight-forward if you can use an info message or error message (at the top of the form) you can use a line like this:

g_form.addInfoMessage("Please <a href = '/incident_list.do'>Click</a>");
g_form.addErrorMessage("Please <a href = '/incident_list.do'>Click</a>");

If you need this to be a field message, and are not opposed to using the verboten DOM, then code like this will work in a Client Script with the Isolate script box unchecked:

var str = "";
var placeholder = "##placeholder##";
g_form.showFieldMsg('v_mc', placeholder, 'info', false); //variable name
str = this.document.getElementsByClassName("fieldmsg notification notification-info")[0].innerHTML;
str = str.substring (0, str.indexOf(placeholder));
this.document.getElementsByClassName('fieldmsg notification notification-info')[0].innerHTML = str + "Please <a href='http://www.ibm.com' target = '_blank'>Click here</a> for more information.";

where 'v_mc' is the name of the variable in this example.

This worked! thank you very much