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?


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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:26 UTC