On Mar 17, 5:02 am, "D.Kreft" <dkr...@gmail.com> wrote:
> A variant of this question pops up on occasion, but none of the
> answers I've seen thus far suit my use case. The solution usually
> involves the recommendation to do something like this:
>
> $(...).validate({
> ...,
> submitHandler: function() {
> // send AJAX request for calculation
> }
> });
>
> What I find unsatisfactory about this solution is that the user is
> still afforded the opportunity to click on a button that gets him
> nowhere. My goal here is to remove that false affordance by starting
> off with the submit button disabled and then only enabling it after
> all fields are correctly filled-out.
It is much more user friendly to let the user complete the form and
submit it. Run validation onsubmit (or onblur of individual fields if
you like) and cancel submit if they don't get it right.
Do not lock users into getting a field valid before letting them
proceed to the next field. By all means display adjacent error text
onblur, but the form only needs to be valid when it is submitted. Its
state in the meantime is irrelevant to anyone but the user.
--
Rob