Expand my Community achievements bar.

Help with script

Avatar

Level 7

How I can validate a field so the users enter the letter K(uppercase) and 7 digits.

Example: K1234567

Thank you

2 Replies

Avatar

Level 10

Hi,

you can use a regular expression in the change event of your field to restrict the input to the desired format (K9999999).

if (!xfa.event.fullText.match(/^[K]\d{0,7}$/g)) {

          xfa.event.change = "";

}

Avatar

Level 7

Hi Radzar,

I tried you script in the change event but for some reason does not allows me to enter any  number into the field!

Field seems to be locked!

Thank you