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
we are using Parsley for a JSF-UI, so we do not have the possibility to conditionally add or remove pass-through-attributes in the UI-Tags. It is only possible to set the parsley-attributes to true or false (or nothing). However parsley treats an available "data-parsley-required" or "data-parsley-validate-if-empty" always as true, not considering its value (if there is a value).
We fixed this by slightly changing the following two methods.
_isRequired: function _isRequired() {
if ('undefined' === typeof this.constraintsByName.required || !this.constraintsByName.required) return false;
return false !== this.constraintsByName.required.requirements;
},
needsValidation: function needsValidation(value) {
if ('undefined' === typeof value) value = this.getValue();
// If a field is empty and not required, it is valid
// Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators
if (!value.length && !this._isRequired() && ('undefined' === typeof this.options.validateIfEmpty || !this.options.validateIfEmpty)) return false;
return true;
},
The change now considers a value for the two attributes if a value is given.
It would be nice considering this changes for a future release.
The text was updated successfully, but these errors were encountered:
Hello,
we are using Parsley for a JSF-UI, so we do not have the possibility to conditionally add or remove pass-through-attributes in the UI-Tags. It is only possible to set the parsley-attributes to true or false (or nothing). However parsley treats an available "data-parsley-required" or "data-parsley-validate-if-empty" always as true, not considering its value (if there is a value).
We fixed this by slightly changing the following two methods.
The change now considers a value for the two attributes if a value is given.
It would be nice considering this changes for a future release.
The text was updated successfully, but these errors were encountered: