hyperlink in on-change client script

RudhraKAM
Tera Guru

Hello there 

I have a requirement where we have a multi choice variable on catalog item, with 3 choices 

if choice 3 is selected we need to show a error message , which we are doing with client script  , in that error message we are redirecting user to another link , as of now we are just displaying the full link in the error message , can we just use click here and hyper link the user from there ?

find_real_file.png

instead of www.google.com   can we add click here so that it will redirect them to web page in new window?

Below is my on change script 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
        if(newValue == '2'){
					g_form.showFieldMsg('center_access','Please go to www.google.com and my random text', 'error');
			
		}
   
}
1 ACCEPTED SOLUTION

Sorry, Hyperlinks are not supported in   gs.showFieldMsg method.

please use below code

 

function onLoad() {


 


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


 


   


 


}

 

Regards,

Sachin

View solution in original post

7 REPLIES 7

 

 

You can't add hyperlink in alert() method.

But, you can use below DOM manipulation in your client script with CAUTION to achieve your requirement

 

	$('element.incident.urgency').insert({
		after: '<tr class="info_message_row"><td colspan="2"><div class="outputmsg_info"><img src="images/outputmsg_success.gifx" alt="Please fill up"><a href="http://www.google.com">Google</a></div></td></tr>'
	});

 

Note : DOM manipulation is not recommended since it may break during future upgrade.

Regards,

Sachin

 

 

vkachineni
Kilo Sage
Kilo Sage

g_form.showFieldMsg('center_access','Please go to ' + "<a href = 'https://www.google.com'>Click</a>" + ' and my random text', 'error');

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

Still not working