Basic test against booleans
See original GitHub issueVersions:
- VueJs: #.#.#
- Vee-Validate:
Description:
Today, I was struggling a bit the validation of booleans (in fact, all started with checkboxes…) I was reading your documentation very carefully, and it seems I can reduce the problem to a couple of lines of code…
Steps To Reproduce:
` let test1 = this.$validator.validate(‘email’, ‘foo@bar.com’); let test2 = this.$validator.validate(‘email’, ‘foo@bar’);
let test3 = this.$validator.validate(‘abooleanfield’, true); let test4 = this.$validator.validate(‘abooleanfield’, false);
console.log(‘test1’, test1) console.log(‘test2’, test2) console.log(‘test3’, test3) console.log(‘test4’, test4) `
test1 and test2 are coming directly from your docu, and are returning the correct results… test3 and test4 are both return TRUE, while I would expect that test4 would return FALSE…
(PS.: I’m talking about the values in the Promises…)
Am I doing something wrong ?
Thanks in advance for your reply,
Johnny
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (7 by maintainers)
@Toilal I kind of want to revert back to the old behavior since false is a value that is provided, so in choices like two radio buttons that makes sense. People can just bind to null if they need something to be required.
I have a component mapping to either
true
,false
ornull
and want to userequired
rule, but this change with false raising rule invalid doesn’t make sense in this case.Maybe we could add a modifier to the
required
rule to support this use case ? Something likerequired:allow-false
?