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

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

--- Comment #7 from TJ VanToll <tj.vantoll@gmail.com> ---
The most popular polyfill for this API (webshims) triggers "firstinvalid" and
"lastinvalid" events.

>From its docs (http://afarkas.github.com/webshim/demos/demos/webforms.html):

firstinvalid: firstinvalid is a simple, bubbling event, which is triggered on
the first invalid form element. Preventing the default of firstinvalid will
automatically prevent the default behavior of all current invalid elements.

lastinvalid: lastinvalid is an extended, bubbling, (but) uncancelable event,
which is triggered on the last invalid form element. The property invalidlist
is a jQuery-collection of all current invalid elements.

I present this to show the most popular solution for this use case in the wild.
 In my mind we only need one event fired after invalid events have been fired
for each invalid field within the form.  

Would it be possible to fire an "invalid" event on the form itself?  The
event's target could be checked, and if it is a form you would know that this
situation occurred.  If not "validation", "forminvalid", "invalidsubmit", etc
would be fine.  We just need a hook.

A mapping of invalid fields --> validationMessage would be a nicety, but it
would also be easy to derive.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 12 March 2013 02:27:49 UTC