Sep 18, 2010 at 2:26 PM


The attribute [RequiredIfFalse] works in server-side validation but not in client side with JQuery.

Thank you for the great effort.

Sep 18, 2010 at 2:51 PM

I checked the situation with MVC validation as well. Like it is in JQuery, RequiredIfFalse is not working in client side.

That's because in the javascript code of RequiredIf if the checkbox is not found as checked, no value is set to dependentValue variable, and with its default null value the function returns with true.

    if (dependentPropertyElement.length > 1) {
        for (var index = 0; index != dependentPropertyElement.length; index++)
            if (dependentPropertyElement[index]["checked"]) {
                dependentValue = dependentPropertyElement[index].value;

        if (dependentValue == null)
            return true;




Sep 20, 2010 at 5:25 PM
Edited Sep 27, 2010 at 9:13 PM

Looking back at this code, I'm near certain this should have been:


if (dependentValue == null)
    dependentValue = false;


Try changing that bit of code and see if it helps - please let me know your results.

I'm going to write a couple of tests to make sure this doesn't break anything, then I'll make the change in source control. 

Sep 20, 2010 at 6:09 PM

I update the JS files and the JS unit tests. You can get the new JS files in this change set: