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

Last updated by Tiago Araújo [SSW] about 1 year 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)"

Adam Cogan
We open source.Loving SSW Rules? Star us on GitHub. Star
Stand by... we're migrating this site to TinaCMS