[whatwg] Form Validity Ambiguity - patternMismatch

Joseph Pecoraro pecoraro at apple.com
Mon Apr 19 23:19:02 PDT 2010


The section describing the pattern attribute does not explain that
it only applies to particular input types [1].

However, one of the tables showing which content attributes apply
to which input types shows the pattern attribute only applies to
particular input types. Namely text, search, url, telephone, email,
and password but not dates, times, numbers, hidden and others:

This disconnect could lead to ambiguous implementations of
ValidityState's patternMismatch which is simply described in
multiple places as:

  [[
    When a control has a value that doesn't satisfy the pattern
    attribute.
  ]] [3]
  

  [[
    returns true if the element's value doesn't match the provided
    pattern; false otherwise.
  ]] [4]
  

These two definitions of patternMismatch do not mention that
they only apply on input type's that the pattern attribute applies
to. If that is the case then I recommend clarifying that constraint
in the description of the pattern attribute [1] and when describing
patternMismatch [3][4]. If that is not that the case then I don't
see the purpose of the table showing that the "pattern" attribute
only applies to particular input types, and I would like clarification
there (like the row being removed or all checkboxes?) [2].

This may also apply to other validity states as well, I haven't
checked others yet.

Cheers!
- Joe

[1]: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-pattern
[2]: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element
[3]: http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#suffering-from-a-pattern-mismatch
[4]: http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#the-constraint-validation-api




More information about the whatwg mailing list