- From: Aryeh Gregor <Simetrical+w3c@gmail.com>
- Date: Mon, 24 Aug 2009 16:14:51 -0400
On Mon, Aug 24, 2009 at 11:22 AM, Smylers<Smylers at stripey.com> wrote: > Are there currently sites using JavaScript to perform the above checks > pre-submission? There are many sites that use server-side checks for those purposes. For instance, almost any site running the popular vBulletin forum software imposes a minimum length on posts. I don't know if many sites do client-side checks, but I'd imagine more would if it were easier. I should say that I can't see myself personally using pattern on textareas. > If so, would the checks be easier to write using a pattern attribute > than they currently are? Yes. For instance, checking for a minimum length of 10 characters is just pattern=".{10,}". Currently you'd have to do . . . I don't even know offhand. My JavaScript isn't good enough. I'd have to spend some time with online references to figure it out. Almost every web developer is very familiar with regex; not every web developer knows much JS. On the other hand, anyone who can write a JavaScript event handler offhand can definitely handle pattern="". I've recently been adding HTML 5 form features to MediaWiki, and found that I was using features that I'd never have considered figuring out the right JS for, because it was so simple. For instance, MediaWiki currently uses JavaScript to autofocus forms on only a couple of pages. When I saw that the autofocus attribute was available and worked in a few significant browsers, I started adding it to every single page where it made sense -- which means most form-based pages. Also things like type=number that we just relied on server-side validation for. Just because authors aren't currently going to the trouble of writing JS doesn't mean they wouldn't use easier methods if they were available. On Mon, Aug 24, 2009 at 1:49 PM, Peter Kasting<pkasting at google.com> wrote: > On Mon, Aug 24, 2009 at 9:08 AM, Chris Taylor <Chris.Taylor at figureout.com> > wrote: >> >> It's been mentioned before about limiting the length of text permissible >> in a <textarea> element, specifically for forums. > > <textarea> is defined to support maxlength already > ( http://www.whatwg.org/specs/web-apps/current-work/#the-textarea-element ). There's no minlength, though.
Received on Monday, 24 August 2009 13:14:51 UTC