OnChange alert for single line text field

CatalogCat
Tera Contributor

I need an OnChange alert (pop up message) on a single line text field, to appear when the user has written something (anything) in the text field. I have scripted similar alerts before, but only based on choices on Multiple choice variables. Can this be done on a text field as well? Here is an example of the code I have used on Multiple choice:

function onChange() {

var choice = g_form.getValue('leader_yn');

if (choice == 'no'){

alert("Please direct inquiries and questions about employee relations to your leader.");

}
}

2 ACCEPTED SOLUTIONS

So what I was trying to say is if you create a onchange client script for a field on the form it will not work.

 

But if you create a onchange client script for a variable on the catalog item it will work.

 

So you want it for a field or a variable.

 

Also that is how currently the system is designed and we cannot do much about it.

 

Please mark my answer as correct based on Impact.

View solution in original post

Hi @CatalogCat ,

 

Of course onchange client script will work on single line text. It works similar to any other filed. For any field how onchange works is, when you are done with your selection. Same way it goes for single line text. Once you are done with filling info in single line text, you click anywhere (this is how you say I am done typing),  and your onchange script will execute.

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

 

 

View solution in original post

6 REPLIES 6

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Normal Onchange client script does not work on single line text but Catalog Client script does work on single line text.

 

Please mark my answer as correct based on impact.

Can you please elaborate? If there is any way I can solve this, can you please give an example?

Thank you.

So what I was trying to say is if you create a onchange client script for a field on the form it will not work.

 

But if you create a onchange client script for a variable on the catalog item it will work.

 

So you want it for a field or a variable.

 

Also that is how currently the system is designed and we cannot do much about it.

 

Please mark my answer as correct based on Impact.

Hi @CatalogCat ,

 

Of course onchange client script will work on single line text. It works similar to any other filed. For any field how onchange works is, when you are done with your selection. Same way it goes for single line text. Once you are done with filling info in single line text, you click anywhere (this is how you say I am done typing),  and your onchange script will execute.

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh