esatterwhite
6 Jul 2011, 11:43 AM
The presence model validator has the unexpected behavior of returning true if the value passed in is nul
the only check in presence is ( value == undefined ).
null will always return true.
It seems like a javascript gotcha. an empty string will evaluate to false, but null will evaluate to true. Technically and empty string is more of a value than a null value. And in the case of a data model, a null value would imply no value and should fail presence validation.
null, empty string and undefined should return false.
the only check in presence is ( value == undefined ).
null will always return true.
It seems like a javascript gotcha. an empty string will evaluate to false, but null will evaluate to true. Technically and empty string is more of a value than a null value. And in the case of a data model, a null value would imply no value and should fail presence validation.
null, empty string and undefined should return false.