<div class="gmail_quote">On Thu, Oct 29, 2009 at 3:03 PM, Ryan Cannon <span dir="ltr"><<a href="mailto:ryan@ryancannon.com">ryan@ryancannon.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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.</blockquote>
<div><br></div><div>I have two problems with this argument:</div><div>* 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.</div>
<div><br></div><div>* 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?</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">> Should an<br>
> input with minlength smaller than it's value be filled with padding<br>
> characters? Before or after the value? And what happens to those<br>
> characters as you type?<br>
<br>
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.</blockquote><div><br></div><div>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.</div>
<div><br></div><div>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.</div><div>
<br></div><div>PK </div></div>