Check validity before handling submit event in cart
This commit is contained in:
parent
ef15a4c9c3
commit
3d8bb09ee8
|
@ -366,8 +366,18 @@ jQuery( function( $ ) {
|
||||||
|
|
||||||
// Catch the enter key and don't let it submit the form.
|
// Catch the enter key and don't let it submit the form.
|
||||||
if ( 13 === evt.keyCode ) {
|
if ( 13 === evt.keyCode ) {
|
||||||
evt.preventDefault();
|
var $form = $( evt.currentTarget ).parents( 'form' );
|
||||||
this.cart_submit( evt );
|
|
||||||
|
try {
|
||||||
|
// If there are no validation errors, handle the submit.
|
||||||
|
if ( $form[0].checkValidity() ) {
|
||||||
|
evt.preventDefault();
|
||||||
|
this.cart_submit( evt );
|
||||||
|
}
|
||||||
|
} catch( err ) {
|
||||||
|
evt.preventDefault();
|
||||||
|
this.cart_submit( evt );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue