You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great component, but I would suggesting having the validation process more open to the ones who use the form generator.
After reading the docs and looking in the source cod I didn't find a good way of validating my generated form exactly when I want. The only implicit way was to declare a submit input which in many real cases doesn't have to be right bellow the inputs.
Another approach would be to declare a ref="myForm" and call this.$refs.myForm.validate() in my custom form submit function. This approach doesn't seem clean to me and might get ugly when you have multiple forms.
I suggest maybe adding an event which will pass the errors array or boolean up to the parent component.
Example:
<vue-form-generator
@errors-changed="handleErrors"></vue-form-generator>//parent component
data:function(){return{isValidForm:false,}},methods:{handleErrors:function(errors){this.isValidForm=errors.length===0;},myCustomSubmit:function(){if(this.isValidForm){//proceed with my form submission}}}
If validateAfterChanged true, the fields run validate and the errors put to the this.schema.errors.
doesn't modify the schema. Put to the local data and call an on-validate event which listen the parent.
formGenerator listen the children on-validate event and append the errors to the self this.errors. Plus call self on-validate.
call the disabled, required, visible & readonly schema functions with field instance as this (Disable submit button #128), plus pass schema as second argument & field instance as third argument
Great component, but I would suggesting having the validation process more open to the ones who use the form generator.
After reading the docs and looking in the source cod I didn't find a good way of validating my generated form exactly when I want. The only implicit way was to declare a
submit
input which in many real cases doesn't have to be right bellow the inputs.Another approach would be to declare a
ref="myForm"
and callthis.$refs.myForm.validate()
in my custom form submit function. This approach doesn't seem clean to me and might get ugly when you have multiple forms.I suggest maybe adding an event which will pass the
errors
array or boolean up to the parent component.Example:
Or alternatively
Necessary code change
The text was updated successfully, but these errors were encountered: