Merge pull request #20001 from woocommerce/fix/19996
Check validity before handling submit event in cart
This commit is contained in:
commit
fb3eacc10f
|
@ -366,9 +366,19 @@ 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 ) {
|
||||||
|
var $form = $( evt.currentTarget ).parents( 'form' );
|
||||||
|
|
||||||
|
try {
|
||||||
|
// If there are no validation errors, handle the submit.
|
||||||
|
if ( $form[0].checkValidity() ) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
this.cart_submit( evt );
|
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