[whatwg] Text areas with pattern attributes?
Jonas Sicking
jonas at sicking.cc
Wed Aug 19 11:38:53 PDT 2009
On Wed, Aug 19, 2009 at 8:32 AM, Geoffrey Sneddon<gsneddon at opera.com> wrote:
> Alex Vincent wrote:
>>
>> I'm drifting into writing code for the pattern attribute on text
>> fields again, and I wondered: if text inputs can have pattern
>> attribute for regular expression matching, why not text area elements?
>
> 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?
A similar argument was made against putting the placeholder attribute
on <textarea>, until someone found a page where it was used.
I think in general it makes very little sense to say that <textarea>s
are different from <input type=text>. Technically the only difference
is that one is multiline and the other is not. So it seems like
anything that makes sense in <input type=text> makes sense in
<textarea>.
So for the pattern attribute, a use case would be on a site that
accepts US addresses (for example a store that only ships within the
US), the site could use a textarea together with a pattern that
matches US addresses.
/ Jonas
More information about the whatwg
mailing list