I'm submitting a ...
Do you want to request a _feature_ or report a _bug_?
I want to request a feature.
Right now, there is a limited number of global field validators that come predefined with the plugin.
Validators included by default do not cover a sufficient variety of possible validation criteria. For example, there is no validator that would require the user to 'check' a checkbox element (validating a value to be true).
Currently, this functionality can be extended by passing custom functions to the validator field in the schema object, but this is a deviation from the API used for default validators (passing them as a string array). My feature proposal is to give developers the ability to pass their custom validators in the Vue.use(VueFormGenerator, ....) plugin inclusion call alongside custom fields. These validators could then be accessed in the schema under the validator array the same way predefined validators are.
Not a bad request... and implementing a way to import custom validators in the init options seems like a good way to go.
However, in the mean time, you can inject them directly ....
VueFormGenerator.validators.customFunc = () = {};
Then just reference “customFunc” in the string array.
@zwx00 how's this PR look?
Looks good, thanks!
Most helpful comment
Not a bad request... and implementing a way to import custom validators in the init options seems like a good way to go.
However, in the mean time, you can inject them directly ....
VueFormGenerator.validators.customFunc = () = {};
Then just reference “customFunc” in the string array.