check HTML5 form validation before POSTing it with ajax (#9450)

This commit is contained in:
Frédéric Péters 2015-12-29 18:16:44 +01:00
parent b7ec4605ec
commit d74c5b553a
1 changed files with 6 additions and 0 deletions

View File

@ -140,6 +140,12 @@
button.click = function() {
if (inplace_submit) {
var action_url = $form.attr('action');
if ($form[0].checkValidity() === false) {
/* if HTML5 validation fails, we trigger a
* click to get the errors displayed */
$form.find('button').click();
return false;
}
$.ajax({
type: 'POST',
url: action_url,