File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed
Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change 108108 var element = $ ( this ) ;
109109 var valid = null ;
110110
111- if ( ( element . is ( "form" ) || element . hasClass ( "validationEngineContainer" ) ) && ! element . hasClass ( 'validating' ) ) {
112- element . addClass ( 'validating' ) ;
113- var options = element . data ( 'jqv' ) ;
114- var valid = methods . _validateFields ( this ) ;
115-
116- // If the form doesn't validate, clear the 'validating' class before the user has a chance to submit again
117- setTimeout ( function ( ) {
118- element . removeClass ( 'validating' ) ;
119- } , 100 ) ;
120- if ( valid && options . onSuccess ) {
121- options . onSuccess ( ) ;
122- } else if ( ! valid && options . onFailure ) {
123- options . onFailure ( ) ;
111+ if ( element . is ( "form" ) || element . hasClass ( "validationEngineContainer" ) ) {
112+ if ( element . hasClass ( 'validating' ) ) {
113+ // form is already validating.
114+ // Should abort old validation and start new one. I don't know how to implement it.
115+ return false ;
116+ } else {
117+ element . addClass ( 'validating' ) ;
118+ var options = element . data ( 'jqv' ) ;
119+ var valid = methods . _validateFields ( this ) ;
120+
121+ // If the form doesn't validate, clear the 'validating' class before the user has a chance to submit again
122+ setTimeout ( function ( ) {
123+ element . removeClass ( 'validating' ) ;
124+ } , 100 ) ;
125+ if ( valid && options . onSuccess ) {
126+ options . onSuccess ( ) ;
127+ } else if ( ! valid && options . onFailure ) {
128+ options . onFailure ( ) ;
129+ }
124130 }
125131 } else if ( element . is ( 'form' ) || element . hasClass ( 'validationEngineContainer' ) ) {
126132 element . removeClass ( 'validating' ) ;
You can’t perform that action at this time.
0 commit comments