W3C home > Mailing lists > Public > www-forms@w3.org > September 2007

Re: limit string length

From: Steven Pemberton <steven.pemberton@cwi.nl>
Date: Mon, 24 Sep 2007 10:44:47 +0200
To: "Mark Birbeck" <mark.birbeck@formsplayer.com>, "Frederik Elwert" <felwert@uni-bremen.de>
Cc: www-forms@w3.org
Message-ID: <op.ty5g8xousmjzpq@acer3010.lan>

On Mon, 24 Sep 2007 08:25:54 +0200, Mark Birbeck  
<mark.birbeck@formsPlayer.com> wrote:
> I think the @constraint way is the best one.

I agree. Apart from it being the shortest, the reason I prefer the  
constraint approach over HTML's maxlength is that it records everything I  
type. When I type I don't necessarily watch the screen while I do it. With  
the maxlength version, the text after the maxlength is just lost (and if I  
don't look I may not even notice).

The constraint approach keeps the text I typed, with a visual indication  
that something is wrong, and preventing me from submitting the data. I can  
then go and edit the offending field to reduce it to size: the text that I  
want to keep may be at the end of the field rather than the beginning.

Small case in point: When I type in my address in a form, I usually 'type  
blind' and tab from field to field. Dutch postal codes consist of 4  
digits, a space and 2 letters. However some wretched sites don't accept  
the space, and have a maxlength of 6 on the field. I type "1234 AA", and  
tab out, and the field contains "1234 A". Now I have to delete the space  
and type another A. The constraint version would have let me just delete  
the space.

Best wishes,

Steven Pemberton
Received on Monday, 24 September 2007 08:45:04 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 10 December 2014 20:11:58 UTC