Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 and validation of programmatically submitted form

I was trying to figure out for some time what is happening with my validation of the HTML5 form and I noticed that:

  1. when I submit the form using its submit button the validation works OK
  2. when try to submit form programmatically using jQuery submit() function it gets submitted and validation does not seem to work.
  3. when I trigger the submit button of the form programmatically, validation works

It is consistent in all OSX browsers (FF5, O11, Chr13) but Safari 5, which actually does not validate in neither of the cases.

Here is the jsFiddle to test.

Why the second option does not work?

like image 485
kwicher Avatar asked Nov 05 '22 19:11

kwicher


1 Answers

Seems like the submit button has to be triggered somehow. This would not surprise, since the browser also does not fire a change event, when one changes the value of a text input via js.

like image 84
Leif Avatar answered Nov 09 '22 11:11

Leif