How to highlight a field in Service Portal?

thiraj
Tera Contributor

Hi Team,

This is a relatively simple question but unfortunately i do not know the exact syntax to use. In our service portal > catalog items > there is a phone

number field. I have written a catalog client script to validate the phone number field to have only 10 characters and it should all be numbers only.

I have set up an alert but unfortunately this is NOT the exact solution. I want to be able to HIGHLIGHT the PHONE NUMBER field in RED if

there is an invalid format. How can this be done? What additional syntax / code do i need in my script. I have attached the script below.

find_real_file.png

All help is appreciated.

Thank you!

2 REPLIES 2

Abhishek Raj3
Tera Guru

Hi Thiraj,



You can use   g_form.showFieldMsg() instead of alert().


g_form.showFieldMsg("field_name", "Hello World", "error");Puts "Hello World" in an error message below the specified field.


find_real_file.png



Thanks,


Abhishek


Hi Abhishek,


I have got that working now. The only issue is that the "SCROLL" function does not work. I want the page to scroll up to the error field once the submit button is clicked. but it does not seem to work.


I have used :


g_form.showFieldMsg('port_number',"Existing Number should only contain 10 digits","error",true);



Thank you