question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Basic test against booleans

See original GitHub issue

Versions:

  • 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:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
logaretmcommented, Jun 21, 2017

@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.

0reactions
Toilalcommented, Jun 21, 2017

I have a component mapping to either true, false or null and want to use required 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 like required:allow-false ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boolean Expressions - Visual Basic | Microsoft Learn
A Boolean expression is an expression that evaluates to a value of the Boolean Data Type: True or False . Boolean expressions can...
Read more >
5-1 Boolean expressions
A boolean expression(named for mathematician George Boole) is an expression that evaluates to either true or false. Let's look at some common language...
Read more >
Conditionals with if/else & Booleans | AP CSP (article)
The condition is a Boolean expression: an expression that evaluates to either true or false . Boolean values are another type of data...
Read more >
If Statements and Booleans
The test can be any expression that evaluates to a boolean value – true or false – value (boolean expressions are detailed below)....
Read more >
What is the most concise way to test a boolean condition with ...
That makes it relatively simple to test whatever combination of ... than all the developers on the team will spend running these tests...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found