sethsandaru / vue-form-builder

Super Form Builder built on top of Vue with Drag & Drop functionality, savable-form-schema and easy to maintain/upgrade your form.
http://vue-form-builder.sethphat.com
MIT License
413 stars 129 forks source link

Fix #115: Custom validation closure does not exist and is bypassed #116

Open dvuckovic opened 2 years ago

dvuckovic commented 2 years ago

It looks like the instance property responsible for collection of custom closures in the Validation class is not properly initialized.

The customClosures property defaults to an empty object {} that is never populated in the constructor.

On the other hand, an erroneous validationClosures property is initialized, but is never read from.

The fix is to initialize customClosures object properly, and custom validators will suddenly start working:

     constructor(valueContainer, controls, definedClosures = {}) {
         this.valueContainer = valueContainer
-        this.validationClosures = definedClosures
+        this.customClosures = definedClosures
         this.setRules(controls)
     }