[whatwg] Three concerns regarding HTML5 form validation

On Wed, Sep 28, 2011 at 6:56 AM, Matias <matiasnu at gmail.com> wrote:
> Hi Mounir and sorry for the late reply,
>
>>> 1) Is there a reason why native form validation seems to be tied to the click of the submit button? Submitting the form using JavaScript does not seem to trigger HTML5 form validation in either Firefox, Opera or the Webkit browsers (I haven't checked how IE10 behaves yet). To me this seems like an unnecessary limitation.
>>
>> .submit() by-passes all possible submit cancellation per spec: there is
>> no submit event sent and given that the validation checks were done in
>> the submit event handler, it seems reasonable to disable the automatic
>> HTML5 form validation.
>
> OK, I understand... so is there a reason not to have a method for triggering the display of validation errors in addition to triggering a click on a submitControl? (I can understand not wanting duplication of functionality, but it would be great for clarity)

I agree that this sounds like a good idea.

One simple solution would be to make checkValidity take a optional
boolean argument which defaults to false. If the function is called on
a <form> and passed true, this instructs the UA to display the same UI
as would be displayed if the form was submitted. If the function is
called on a individual control and passed true, this instructs the UA
to display any UI it would for that control.

/ Jonas

Received on Wednesday, 28 September 2011 17:25:04 UTC