Text Field format

Hello all

I want to set a text field format to take only numbers ranging from 5 digits to 9 digits.
ex: 11111 or 11111-1111
But when I set the field format to #####-#### it force to enter 9 digits.
I need last 4 digits optional. Because my need is 5 digit to 9 digit numbers.

So is there any way to set the text field format to achieve this?

Thanks in advance

attach an ‘onDataChange’ method to this field and validate the data which has been entered.

Depending on ‘pass’ or ‘fail’ you can return a boolean and the user will see his/her data in red when it fails…

mboegem:
attach an ‘onDataChange’ method to this field and validate the data which has been entered.

Depending on ‘pass’ or ‘fail’ you can return a boolean and the user will see his/her data in red when it fails…

Thanks for the quick reply.