[whatwg] Text areas with pattern attributes?

Smylers Smylers at stripey.com
Mon Aug 24 08:22:25 PDT 2009


Aryeh Gregor writes:

> On Wed, Aug 19, 2009 at 11:32 AM, Geoffrey Sneddon<gsneddon at opera.com>
> wrote:
> 
> > What's the use-case for it? Textareas are almost always for such
> > large amounts of input that they are almost always free-form text.
> > Why allow the pattern attribute?
> 
> You could impose a minimum character length for posts -- that's common
> on forums.  Or ban certain words or phrases.

Are there currently sites using JavaScript to perform the above checks
pre-submission?

If so, would the checks be easier to write using a pattern attribute
than they currently are?  (If they aren't then it seems unlikely authors
would bother with it.)

Max Romantschuk writes:

> Mike Shaver wrote:
> 
> > It's also pretty common to enter multiple email addresses or
> > tracking numbers or URLs one-per-line for batch operations on sites,
> > and they would benefit from having client-side validation of such
> > patterns.
>
> I also believe that it would be beneficial to have an option to  
> regex-validate a text area in cases like this.
>
> It's not far fetched to imagine copy-pasting a bunch of data from a
> spreadsheet column into a textarea, in which case it would make sense
> to  be able to have client side validation for a given pattern
> repeated n times with newlines in between.

Are there any such sites already?  If there aren't, it seems unlikely
that the lack of <textarea pattern=...> is what's holding them back.

> I really don't see a case for not allowing pattern for a textarea.

The point is to have cases specifically _for_ it -- not adding
everything for which there isn't a reason against.

If <textarea pattern=...> wouldn't in practice be used by authors then
there's no point in adding it.  If it would be used then it should be
trivial to show some places where it would be used.

Smylers


More information about the whatwg mailing list