File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1212 methods: {
1313 onClick ($event ) {
1414 if (this .schema .validateBeforeSubmit === true ) {
15+ // prevent a <form /> from having it's submit event triggered
16+ // when we have to validate data first
17+ $event .preventDefault ();
1518 let errors = this .$parent .validate ();
1619 let handleErrors = (errors ) => {
1720 if (! isEmpty (errors) && isFunction (this .schema .onValidationError )) {
18- this .schema .onValidationError (this .model , this .schema , errors);
21+ this .schema .onValidationError (this .model , this .schema , errors, $event );
1922 } else if (isFunction (this .schema .onSubmit )) {
2023 this .schema .onSubmit (this .model , this .schema , $event);
2124 }
2730 handleErrors (errors);
2831 }
2932 } else if (isFunction (this .schema .onSubmit )) {
33+ // if we aren't validating, just pass the onSubmit handler the $event
34+ // so it can be handled there
3035 this .schema .onSubmit (this .model , this .schema , $event);
3136 }
3237 }
You can’t perform that action at this time.
0 commit comments