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  ||  9x 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.