[whatwg] A mechanism to improve form autofill

Smylers Smylers at stripey.com
Thu Jul 26 02:27:53 PDT 2012

Aryeh Gregor writes:

> On Thu, Jul 26, 2012 at 11:52 AM, Smylers <Smylers at stripey.com> wrote:
> > Perhaps specifying certain autocomplete types could set defaults for
> > pattern and inputmode? So for this example autocomplete=cc-num
> > would, if pattern isn't specified, imply pattern=\d{16}, and
> > equivalently for inputmode?
> That would be surprising, because autocomplete is just a hint,

That's a matter of definition. If you squint autocomplete could be seen
as the 'purpose of this field' attribute (which just happens to be
called autocomplete because we already have an attribute of that name to
build on).

> pattern doesn't allow form submission if it's not met. 

Possibly only surprising to people who bother to think about it in those
terms. I suspect many web developers would simply find it convenient.

> Also, I couldn't swear to you that all credit card numbers are
> actually 16 digits,

True. But whatever the actual pattern is, it isn't useful to the owner
of a debit card with an 18-digit number if the pattern varies between
sites and some only allow 16 digits to be submitted.

I'd rather trust Hixie to find out what the rules are and bake them into
the spec than for every separate webmaster to try to get this right,
because some inevitably won't, especially if there are rules which
apparently work for many common cases but actually exclude a minority.

> or that they will forever be 16 digits, so I'm hesitant to
> make that connection canonical.

If the format for credit card numbers changes significantly enough to
break patterns that have been working for years, we're in trouble
wherever those patterns have been specified.



More information about the whatwg mailing list