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
414 stars 129 forks source link

Fix #113: Impossible to turn off validation error alert #114

Open dvuckovic opened 2 years ago

dvuckovic commented 2 years ago

Issue #113 stems from a faulty assignment in the plugin installer:

    // show alert or not?
    formDI.validationErrorShowAlert = properties.validationErrorShowAlert || true

This will always default to true value in case properties.validationErrorShowAlert is "falsy".

We can fix this by checking if the option was defined first, and assign the default only if it wasn't.

     // show alert or not?
-    formDI.validationErrorShowAlert = properties.validationErrorShowAlert || true
+    formDI.validationErrorShowAlert = typeof properties.validationErrorShowAlert !== 'undefined'
+        ? Boolean(properties.validationErrorShowAlert)
+        : true