Do you use HTML "maxlength" attribute to limit number of characters on input fields?

Last updated by Tiago Araújo [SSW] 4 months ago.See history

Rule 1: Whenever you have a data entry page you should always use the HTML maxlength attribute to limit number of characters to the length of the field in the table (except for numbers).

Rule 2: Whenever you have a situation where you are using the HTML textarea (does not have the maxlength property).

Then you need to:

  • Add the JavaScript function. E.g. ValidateLength(control)
  • Add 2 properties to every data control. E.g. dataType="char" onkeyup="validateLength(this)"
We open source. Powered by GitHub