Skip to main content
Participant
May 17, 2006
Question

Limit Text field length

  • May 17, 2006
  • 2 replies
  • 307 views
Hi All
I have a field of type CHAR length=9. It should hold 9 digit for ID number. In Dreamweaver MX insert form, how can I do form validation to check that the user enter 9 digits (excatly 9 digits other wise a message should appear telling him to enter 9 digits)

I'm using PHP My SQL and Dreamweaver MX

Thanks
This topic has been closed for replies.

2 replies

BeshayerAuthor
Participant
May 20, 2006
Does any one knows a useful online tutorial that explain that?

Thanks
Participating Frequently
May 17, 2006
In the form itself, you can specify the maximum number of characters that can benetered in the field. Select the field in Design view and set Max Chars to 9. (n code view, set the maxlength attribute to 9.)

To verify that the user entered all 9 characters, create a javascript function that runs on the onChange event. The javascript should check for a field length of 9, and alert the user if less than that. I believe you can check the length of the field contents using document.form1.field1.value.length(), where form1 is the name of your form and field1 is the name of your text field.