MichaelintheUK
Programmer
Hello
I have a text box on a form into which is entered a 7 or 8 character id number. In most cases this is all numbers - however because of amalgamations with other sites they have id numbers with a prefix of A or B followed by the rest being digits. I have managed to provide checks for the length and restricted the keypress to only accept the following:
0123456789AB or delete or backspace.
However I want to allow the A or B or a digit only as the first character and then only allow digits for the rest of the id number.
This is a problem when editing because at the keypress stage the edited key position is not known?
Is this possible using the keypress or is there another way to differ the validation rules between the first character and the rest of the characters?
thanks
Michael
I have a text box on a form into which is entered a 7 or 8 character id number. In most cases this is all numbers - however because of amalgamations with other sites they have id numbers with a prefix of A or B followed by the rest being digits. I have managed to provide checks for the length and restricted the keypress to only accept the following:
0123456789AB or delete or backspace.
However I want to allow the A or B or a digit only as the first character and then only allow digits for the rest of the id number.
This is a problem when editing because at the keypress stage the edited key position is not known?
Is this possible using the keypress or is there another way to differ the validation rules between the first character and the rest of the characters?
thanks
Michael