How do I limit a number field to be only 9 digits? Thanks
Priya
How do I limit a number field to be only 9 digits? Thanks
Priya
Hi Priya,
The number range should work be setting the max to 999,999,999 and/or the min if you allow negative numbers.
Thanks. But, I want the user to be able to enter just 9 digits, not 8 or 10. It should accept just 9 digits.
Priya
Ah ..
The easiest solution would be to use a single line text field with a regular expression: \d{9}
Add text (above/below) to indicate it must be 9 digits or a process error message.
Does your input allow entries that start with leading 0's?
If not you could use a min and max on a number field, 111111111 and 999999999.
You can check a number field with a little jquery but I am not sure how you would actually 'enforce' the entry unless you made the field required and the script blanked the entry if it was not 9 digits:
$('#q4 input').change(function() { if ( $(this).val().length !== 9 ) { alert("Number must be 9 digits"); $('#q4 input').val(''); } });
A reg exp on a text field seems the best bet.
Thanks all.
Priya