-
Notifications
You must be signed in to change notification settings - Fork 533
validateBeforeSubmit doesn't prevent the submit #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I found a solution to prevent the submit when there is an error, but i think Code example : <template>
<form @submit="onSubmit">
<vue-form-generator ... @validated="setValidState"/>
</form>
</template>
<script>
import VueFormGenerator from 'vue-form-generator';
export default {
...
data() {
return {
isValid: false,
};
},
methods: {
setValidState(isValid) {
this.isValid = isValid;
},
onSubmit(event) {
if (!this.isValid) {
event.preventDefault();
}
},
},
...
};
</script> |
…idationError and call preventDefault when onValidateBeforeSubmit is true We can't prevent the submit after waiting for async validation, so we just prevent it before calling any validation and let the user manually submit the form in the `onSubmit` handler, if it validates.
Please refer to #408 - I recommend not placing VFG inside of a form, if you do, that form should have it's own onSubmit handler. I've pushed a change that calls |
* feature/434-validateBeforeSubmit: closes vue-generators#434, vue-generators#408 - added $event to onValidationError and call preventDefault when onValidateBeforeSubmit is true fieldUpload.vue: rename event to Fix vue-generators#422 fieldUpload event throws ReferenceError in Firefox Fix NaN with value 0 on input type number/range. closes vue-generators#419, vue-generators#420 - links to new public custom fields Add issue and PR template 2.2.1 releases setup automate releasing ... vue-generators#409 - fixed id property in fieldUpdate # Conflicts: # dist/vfg-core.css # dist/vfg-core.js # dist/vfg.css # dist/vfg.js # package-lock.json # package.json # src/fields/core/fieldUpload.vue
Current :
When an input submit has
validateBeforeSubmit
setted totrue
the form is not prevented from submitting and call theonSubmit
callback when there is errors.Expected :
It should not submit if there is errors.
The text was updated successfully, but these errors were encountered: