RequiredIfFalse ClientSideValidation


ClientSideValidation width this Attribute [RequiredIfFalse] work in a wrong way, inverted from the good cinematic.
It seem to be caused by the function 'foolproof.is' in 'mvcfoolproof.unobtrusive.js'
If the value2 is "False" this code doesn't work correctly :

if (value1 == "false") value1 = false;
if (value2 == "false") value2 = false;

I fix width :
if (value1.constructor === String && value1.toLowerCase() == "false") value1 = false;
if (value2.constructor === String && value2.toLowerCase() == "false") value2 = false;



TanyaLi wrote Jun 25, 2014 at 3:36 PM

Ye, I encountered the same issue,

in MVC4, a hidden field is rendered in client side with value : 'True' or 'False'
@Html.HiddenFor(model => model.Id)

but in the isBool function, its comparing with true/false or 'true'/'false'

The problem about fixing this lib is that in the future, when the lib got updated, then what happens to our fix made to it manually ? pain to maintain.

Hope future releases would include all reported issues.


wrote Jun 25, 2014 at 3:57 PM

wollmanmena wrote Jul 3, 2014 at 2:07 PM

This fix works perfect for me thanks MVC 4 & EF

ssswagatss wrote Oct 21, 2014 at 2:11 PM

Great.. This fix truly worked.. Thanks a lot.. Please change this in the code. @author.