RequiredIfNot misbehaving

Aug 10, 2012 at 9:14 AM

Hello,

I have two text boxes "Area From" and "Area To" in addition to a select element of "Area Unit".

At the model level, here is what Im adidng:

[RequiredIfNot("SearchItemAreaTo", "0", ErrorMessage = "Unit Id required if To has a value")]

At the client side, here what's being generated:

<select class="valid" data-val="true" data-val-number="The field Area must be a number." data-val-required="The Area field is required." data-val-requiredif="Unit Id required if To has a value" data-val-requiredif-dependentproperty="SearchItemAreaTo" data-val-requiredif-dependentvalue="0" data-val-requiredif-operator="NotEqualTo" id="SearchItemAreaUnitId" name="SearchItemAreaUnitId"><option value="-1"> </option><option value="1">m2</option><option value="2">sq ft</option></select>

 

Appreciate your help,

Regards