Vue-form-generator: v2.2.0 doesn't validate properly

Created on 26 Mar 2018  路  3Comments  路  Source: vue-generators/vue-form-generator

I'm submitting a bug for the latest version of VFG

The latest version (2.2.0) will allow you to submit a form without allowing validation to work as it should.

We are using VFG and want to make sure the user can't bypass any questions and submit a blank form.

Here's a fiddle:
https://jsfiddle.net/0mg1v81e/2105/

2.1.1 works, but 2.1.1 didn't have the $event param which we need to protect from post backs (putting this within a .NET app) without any issues so we upgraded to 2.2.0, only to find the form isn't handling validation right. If there is a workaround for this please let me know how I can hack this and release this app.

Most helpful comment

You should update to 2.2.1 (the latest), and implementing "onValidationError" solves the problem.

If you don't implement the "onValidationError" callback, then "onSubmit" can check the VFG instance's "errors" array to see if it is empty, and decide whether or not to proceed.

Updated JSFiddle

NOTE: I added the ref="vfg" to the VFG tag, and "onValidationError" is currently commented out showing the "onSubmit" ref check ... uncomment the "onValidation" callback to try that out.

All 3 comments

You should update to 2.2.1 (the latest), and implementing "onValidationError" solves the problem.

If you don't implement the "onValidationError" callback, then "onSubmit" can check the VFG instance's "errors" array to see if it is empty, and decide whether or not to proceed.

Updated JSFiddle

NOTE: I added the ref="vfg" to the VFG tag, and "onValidationError" is currently commented out showing the "onSubmit" ref check ... uncomment the "onValidation" callback to try that out.

@zoul0813 ok great, so going forward I should use either (ref=vfg or onValidationError) to handle validation? I didn't see it in the docs, I apologize if I over looked it.

You can use onValidation error to catch errors, or you can check the VFG instances errors array to see if any exist

Some of these changes haven鈥檛 made it into the docs yet

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ndro picture ndro  路  4Comments

sjordan1975 picture sjordan1975  路  5Comments

miseeger picture miseeger  路  4Comments

jewbetcha picture jewbetcha  路  3Comments

lionel-bijaoui picture lionel-bijaoui  路  5Comments