|
Rule 1: Whenever you have a data entry page you should always use the
MaxLength property to the same as the length of the field in the table(except
for numbers).
State: (maxlength="3")
Rule 2: Whenever you have a situation where you are using:
-
the HTML TEXTAREA (does not have the maxlength property), or
-
have a SQL Server table exceeding the limit of 8060 bytes. (Developers
sometimes define the table with char/varchar sizes that exceed this, in order
to give the user flexibility in which fields they want to store the data).
eg. 
Then you need to:
-
add the javascript function eg. ValidateLength(control)
-
add 2 properties to every data control eg. dataType="char"
onkeyup="validateLength(this)"
More information:
The below form demonstrates the client side validation that is required on a
HTML page. The javascript function calculates the bytes (based on the data type
and field size).
Once 8060 bytes are used the user is given a visual
indications about the remain size left.
|