1

I'm using the latest RC with asp.net mvc 3, and have turned on unobtrusive javascript validation and added the necessary scripts to the page. All of the validation works perfectly, but when I try to submit the page, it simply doesn't post. If I turn unobtrusive javascript off in the web.config without making any other changes, everything works perfectly fine.

Here's my scripts I'm using:

<script src="@Url.Content("~/Scripts/jquery-1.4.4.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>

Inside the page it's just a standard form using Html.BeginForm().

2 Answers 2

3

Might help to put some more information so we can try to repro this.

The form won't post if something is invalid. So chances are a field is not valid, but you maybe you don't have the display set up properly. Did you make sure to add a call to Html.ValidationMessageFor(...) for each form field? That renders a span where the client validation message appears.

Sign up to request clarification or add additional context in comments.

2 Comments

What Haacked said - you probably have a validation rule that's being violated but you may not see the red error message if you don't have Html.ValidationSummary or Html.ValidationMessageFor enabled.
Strange, turning it back on it now seems to be working, I changed the Summary to display all validation messages even property ones, and now it's working for both scenarios. Thanks for the help.
0

This also happens when hidden fields are required. Such a simple thing, but it has caused me quite a bit of stress.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.