- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Wed, 02 May 2012 22:36:21 +0300
- To: Han <hvpost@gmail.com>
- CC: www-validator@w3.org
2012-05-01 16:21, Han wrote: > I use the following code: > <textarea name=\"c_opm\" rows=\"2\" cols=\"60\" maxlength=\"255\">" . > $c_opm . "</textarea> That’s presumably code used to generate HTML markup, not the actual markup (which is what validators get). Anyway, maxlength attribute is not defined for a textarea element in HTML 4.01 or XHTML 1.0. However, it has support in modern browsers, and it is defined in HTML5 drafts. > when i use the HTML-validator the section over maxlength gives the error > there is no attribute "MAXLENGTH" That’s because the document type you have specified does not allow it (for textarea). If you consider validating against HTML5, note that HTML5 forbids several constructs that are valid in HTML 4.01 Transitional and even some that are valid in HTML 4.01 Strict. So it’s both more permissive and more restrictive than HTML 4.01. > I use this to limit the number off postions that the user can fill in, > and it works, but the attribute is not on > http://www.w3schools.com/tags/tag_textarea.aspr The w3schools site is notorious for its inaccurate and incorrect information (see http://w3fools.com ). Check out http://www.w3.org for authoritative specifications. > Is it a general attribute or should it not be used? Use it, but do not rely on it. It may not work on old browsers, and any client-side checks can easily be bypassed if the user wants to. That is, if the limitation is needed, it should be enforced in the form handler. Client-side checks should be regarded as added convenience to users, not more. Yucca
Received on Wednesday, 2 May 2012 19:36:51 UTC