formapro / JsFormValidatorBundle

The Javascript validation for Symfony 2, 3 and 4 forms
MIT License
128 stars 56 forks source link

Choice.js strict checking returns false when should be true #142

Closed warrenwegs closed 6 years ago

warrenwegs commented 6 years ago

I believe the strict checking callback (https://github.com/formapro/JsFormValidatorBundle/blob/master/Resources/public/js/constraints/Choice.js#L107) in should look like

        if (this.strict) {
            var callbackFilter = function (n) {
                var result = true;
                for (var i in validChoices) {
                    if (n === validChoices[i]) {
                        result = false;
                        break;
                    }
                }
                return result;
            };
        }

Will try to submit a pull request when I have time