Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Text box should start with '_'

mohammedhyderal
Kilo Contributor

Hi All,

I have a requirement of placing a validation   in the text box,

It should start with '_A' , If not it should throw as error

16 REPLIES 16

Not an issue for me



Thanks


Ankur


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

xiaix
Tera Guru

if (newValue.indexOf('_A') != 0 && g_form.getValue('u_impacted_users') != '')


{


  alert("It should start with an underscore _A");


  g_form.setValue('u_impacted_users', '');


}



Careful about using g_form.setValue() on an onChange script.   It'll run into an infinite loop.