Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Force CAPS on Fields

billv6
Kilo Expert

Hello guys,

 

Today I've received a request to only allow CAPS and not allow alpha as first character on two fields on CMDB CI form.

 

I've searched for this in the wiki and I did not find an answer, someone knows if this is possible?

 

Thanks!

1 ACCEPTED SOLUTION

paul_mcnamara
Giga Expert

You could use a client script on change of the field.


var str = g_form.getValue('field name');


var str = str.toUpperCase();


g_form.setValue('field name',str);


View solution in original post

4 REPLIES 4

Sanjeev Kumar1
Kilo Sage

Hi,


You need to create onChange or onSubmit   Client Script which check by Regular expressions in JavaScript.


it's may be help full for you.



string - javascript validation - only allow one capital letter - Stack Overflow


paul_mcnamara
Giga Expert

You could use a client script on change of the field.


var str = g_form.getValue('field name');


var str = str.toUpperCase();


g_form.setValue('field name',str);


Thanks Paul for this - it was real helpful.

billv6
Kilo Expert

Thanks guys, it worked!