[whatwg] Request to reconsider <input minlength="">
pkasting at google.com
Thu Oct 29 15:35:21 PDT 2009
On Thu, Oct 29, 2009 at 3:03 PM, Ryan Cannon <ryan at ryancannon.com> wrote:
> In order to correctly report the error to the user, I would have to do a
> second check of the value to figure out the problem. The only way to
> determine that the error was caused by too few characters as opposed to
> invalid characters would be to parse the pattern="" attribute in order to
> determine a minimum length required by the RegExp.
I have two problems with this argument:
* It assumes you know enough detail of your validation pattern to know that
it can fail distinctly for "too short" versus something else, and you want
to report those differently, yet you don't actually know the precise
conditions that trigger those errors well enough to code them directly, and
instead you have to parse the pattern yourself after-the-fact. This seems
like a stretch.
* It assumes that "too short" is semantically distinct from "fails
validation for other reasons", when other distinctions seem potentially just
as important. For example, many password implementations require a minimum
number of numeric digits or characters of some other type. Why is "too few
characters of type X" so much less worthy of distinct handling in the spec
than "too few characters of any type", if the primary use cases here are
fields like passwords and usernames?
> Should an
> > input with minlength smaller than it's value be filled with padding
> > characters? Before or after the value? And what happens to those
> > characters as you type?
> My answer: the UI should not be altered due to the presence of minlength
> until validating the input value. There's no need to pad the value or
> prevent deletion of characters.
With maxlength, UAs can provide a version of the user's input that obeys the
constraints. Without some form of padding, the same is not true of
minlength. The distinction in handling these makes me uncomfortable.
I agree with you that if your sole goal is to tell the user that something
is too short, minlength saves you a bit of code. I'm not convinced it's
compelling enough that it must go in.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the whatwg