Real-Time Checking of Flag Message in Onchange with Phone Validation

Jeck Manalo
Tera Guru

Hi Everyone,

 

Is there a way that when you input a flag message in variable using onchange it will pop-up a realtime message if its a valid phone or not ?

 

What I mean is you dont need to click outside the single line text to reflect the checking.

 

if (!valid) {
            g_form.showFieldMsg("phone_number", "Phone number you entered for " + country + " is invalid. Please enter the number in the correct format.", "error");
            g_scratchpad.phone_status = "invalid";
        } else {
            g_form.showFieldMsg("phone_number", "You entered a valid phone number for " + country + ".", "info");
            g_scratchpad.phone_status = "valid";

 

example:

 

JeckManalo_0-1741165488734.png

 

JeckManalo_1-1741165525400.png

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Jeck Manalo 

not possible with the OOB text variables.

The onChange script will trigger only when you click outside somewhere after entering the text.

You can use Custom variable with widget inside it and have it real-time but it will be heavy customization and you will have to ensure the values entered in HTML input in widget are reflected within RITM form as well somewhere because data for widget is not stored somewhere as compared to other variables.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Jeck Manalo 

not possible with the OOB text variables.

The onChange script will trigger only when you click outside somewhere after entering the text.

You can use Custom variable with widget inside it and have it real-time but it will be heavy customization and you will have to ensure the values entered in HTML input in widget are reflected within RITM form as well somewhere because data for widget is not stored somewhere as compared to other variables.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Jeck Manalo 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you ankur for always replying to my concern.