Client Side Validation with FoolProof

Jun 17, 2010 at 2:24 PM


i downloaded foolproof and incorporated it in my project. while it works great on server side, i m still unable to get validations on client side despite adding js file provided with foolproof project. Furthermore, i have also tried making ModelValidator and registered it in global.asax but to no gain. if anybody can tell me how to enable client validations, i will be grateful



Aug 10, 2010 at 5:47 AM

Hi Adeel,

Did you get it working yet? If not, did you make sure to add the "Html.ValidateFor(...)" code to your data entry page?

I hope this helps.



Dec 21, 2010 at 12:44 PM

Sorry to hyjack the thread but it's been over 3 months so i hope you don't mind.

I am having the exact same issue.

		[Required(ErrorMessage = "Please make a selection")]
public bool? First { get; set; }

[RequiredIfTrue("First", ErrorMessage="Please make a selection")]
public bool? Dependent { get; set; }

Using the ViewModel above will result in First to be validated on the client but Dependent to be validated on the server.

I have included:

    <script src="<%: ResolveUrl("~/Scripts/MicrosoftAjax.js")%>" type="text/javascript"></script>
    <script src="<%: ResolveUrl("~/Scripts/MicrosoftMvcAjax.js")%>" type="text/javascript"></script>
    <script src="<%: ResolveUrl("~/Scripts/MicrosoftMvcValidation.js")%>" type="text/javascript"></script>
    <script src="<%: ResolveUrl("~/Scripts/MvcFoolproofValidation.min.js")%>" type="text/javascript"></script>

And have this on my view:
                    <td width = "185px">
                        <%: Html.DropDownListFor(model => model.First, Model.YesNo, "-- Please Select --")%>
                        <%: Html.ValidationMessageFor(model => model.First, "*")%>
                    <td width = "185px">
                        <%: Html.DropDownListFor(model => model.Dependent, Model.YesNo, "-- Please Select --")%>
                        <%: Html.ValidationMessageFor(model => model.Dependent, "*")%>

Many thanks,
Dec 21, 2010 at 1:02 PM

Found the solution in another thread, is to do with an error in the JS file.