This project is read-only.

xVal and remote validation rules with empty values

Nov 19, 2009 at 10:35 PM

I have a textbox..

<input id="state" name="state" type="text" value="" />

 And I'm trying to add a remote rule to it.

<%= Html.ClientSideValidations()
    .AddRule("state", new RemoteRule(Url.Action("ValidateNeedForState")))%>

In that remote action I want to see if the country is "US" and if so, make sure there is a state provided. This rule only fires when I actually enter a state. If I try to submit without entering a state, it posts and I pick up the problem on server side, but I feel I should be able to post this rule before submitting the form. Is this possible?