W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2014

[whatwg] Wish for HTMLFormElement.checkValidity(boolean)

From: Paul Benedict <pbenedict@apache.org>
Date: Fri, 7 Nov 2014 09:37:16 -0600
Message-ID: <CABLGb9zr_5HigBHSLKCi_s4aU=AksF=5fWvT_meoRP1a2TMTfQ@mail.gmail.com>
To: whatwg@whatwg.org
So I had to go back into the list archives in 2011/2012 to see the reasons
for current behavior. Scripting has no way of trigger full UI validation.
Calling form.submit() submits without validation; calling
form.checkValidity() will highlight an error but not do any messages. The
reason stated was [1]:

"The theory is that if you are not letting the user agent submit the form,
you probably also want to display the validation UI manually. You can
easily do that by using the "validationMessage" attribute on all the
elements in the form.elements list."

I don't think that theory is correct. When I looked around, there are too
many internet questions asking how to trigger full UI validation with
scripting. People are looking for this solution (including myself). Today,
the only "full" solution is to completely take over validation and display
messages manually to mimic the browser's default behavior. That's not
really appealing. I am disappointed that I have to "reinvent the wheel" (UI
wise) simply because I want to customize form submission behavior.

One possible solution was to introduce a boolean flag to control when
messages show up [2]. That sounds like a much needed solution. What are
your thoughts on introducing this method?

[1]
http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Jan/0255.html
[2]
http://lists.w3.org/Archives/Public/public-whatwg-archive/2011Sep/0301.html

Cheers,
Paul
Received on Friday, 7 November 2014 15:37:46 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:32 UTC