[whatwg] Web Forms attributes: minlength / autocomplete

Anne van Kesteren schreef: 
>>> Why can't you use pattern= for this?
>>
>> Maybe I could use that, but as a front-end developer I'm not aware of 
>> all the possibilities and grammar of regular expressions (as goes for 
>> a lot of front-end developers I guess, even proffessionals).
>> I guess pattern can be used instead of the maxlength and required 
>> attributes as well and it even makes the input types email and url 
>> obsolete (in a technical manner).
>
> No it does not. It does not serve the same purpose as required and 
> does not allow the user agent to recognize email or url input controls.

But if you can use pattern to define a minimal length, than I'm sure you 
can define a minimal length bigger than 0, which makes it required. 
Using a 'required' attribute is much easier of course, but so would be 
minlength.
As for the input type url and email... you're right But why is it 
necessary that user agent recognize these as such? If it's because they 
have to be able to validate the values of these fields then pattern 
would be sufficient as well. The semantics would not be the same of 
course and that's why I added "(in a technical manner)".

Just to avoid misunderstanding: I'm not at all against the attributes 
required and maxlength or the input types url and email. I'm just 
wondering why the same argument is accepted for some attributes, but 
rejected for others.


>> But I thought HTML5 was to make things better and easier. For most 
>> people minlength will be a whole lot easier to use than pattern as 
>> regular expressions are not really intuitive to write. And as there 
>> is already a maxlength attribute (which will probably not be 
>> deprecated) I think it's more logical to have a minlength as well.
>
> What are the use cases?

Well, to require a minimum value length of course ;-)
For instance some reference codes, zip codes or telephone numbers have a 
certain length, but maybe not alway the same notation.
As you know telephone numbers in the Netherlands have 10 digits, but 
some people prefer to write them all together, and others seperate them, 
using spacers and/or hyphens. If you want to allow people to write their 
number in their own fashion (which is a good thing from a usability 
point of view) then you know the number must be at least 10 characters 
long. Same for Dutch zip codes that are sometimes written with a space 
in them and sometimes not, but they're at least 6 characters long.

Perhaps you want users to come up with a password that's at least 6 
characters long or maybe you just want your replicants to come with a 
better argument than "just because", so you could set minlength="13" ;-)
I'm sure there are hundreds of uses for a minlength attribute, and 
pattern is just harder to use because of the regular expressions. I'd 
even say it's too hard to use for a lot of people.


>> <...> But if we want to stay in tune with all existing 
>> implementations, then maybe we should at least ask the browser 
>> vendors to wait with implementing HTML5 features untill the specs are 
>> final. An element like <canvas> is new to HTML5 but also already 
>> implemented in a couple of browsers (well, I don't have to tell you 
>> that of course). Following your argument a of of its specs may not be 
>> changed anymore, even though the HTML5 specs are still in working draft.
>
> Correct. The specification is driven by implementation and vice versa.

So browser vendors can close the discussion then by making sure they're 
the first to implement? Hmmm, that makes you think.
Well, at least I'm glad IE is not at the forefront of browser 
development anymore. That would be really scary.

cheers,
Sander

Received on Wednesday, 6 June 2007 06:39:10 UTC