[Bug 19751] New: Constraint Validation - Add a means of detecting invalid form submissions

https://www.w3.org/Bugs/Public/show_bug.cgi?id=19751

          Priority: P2
            Bug ID: 19751
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org
          Assignee: erika.doyle@microsoft.com
           Summary: Constraint Validation - Add a means of detecting
                    invalid form submissions
        QA Contact: public-html-bugzilla@w3.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: tj.vantoll@gmail.com
          Hardware: All
            Status: NEW
           Version: unspecified
         Component: HTML5 spec
           Product: HTML WG

The traditional means of performing client side validation has always been to
listen for the submit event on a form, manually perform some error checking
logic, and prevent the form submission if necessary.

With HTML5's constraint validation this approach no longer works because a form
will not fire a submit event until its data is deemed valid.  For most
situations this is fine, but with the current constraint validation API it is
not possible to know when a user attempted a form submission and it was
prevented.

Yes an invalid event will be fired for each invalid field, but there's no way
tell whether that event occurred because the user has just finished interacting
with that field (i.e. blur), versus an attempted form submission.

Use case: Display a list of all error messages to the user whenever they
attempt a submission with invalid data.  This is a technique frequently used on
web forms and it is difficult to implement with the constraint validation API
currently.

At the moment you have to listen for anything that might trigger a submission
(usually clicks of submit buttons) and run the appropriate logic there.  I give
concrete code on how I've implemented this here
http://tjvantoll.com/2012/08/05/html5-form-validation-showing-all-error-messages/.

While this works it is not ideal.  An event fired on the form whenever a form
submission was attempted and failed (much like invalid on form elements) would
make the implementation much simpler.

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Monday, 29 October 2012 03:02:34 UTC