1

I have a simple Login page that suddenly (After upgrading Jquery.js and Jquery-ui.js to 1.10.2 and 1.10.3 respectively) started to actually reach the action result instead of showing the client side validation messages defined on the E.F Data Annotations.

So I found out that removing the only CheckBoxFor that I have besides the User and Password, the submit button actually works as it should be so that it raises client validations only without reaching the controller.

Any reason for this behaviour ?

Thanks !!

Code below :

@using System.Web.Optimization;
@model MyProject.Models.LogOnModel

@{
    ViewBag.Title = "Entrar";
}

<h1>@ViewBag.Title</h1>

<p>
    Se pretende obter acesso clique @Html.ActionLink("aqui", "Register").
</p>

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")



@using (Html.BeginForm())
{
    @Html.ValidationSummary(true, "O seu acesso falhou. Por favor corriga os erros e tente novamente.")
    <div>
        <fieldset>
            <legend>Informação da sua conta</legend>

            <div class="editor-field">
                @Html.LabelFor(m => m.Email)
                @Html.TextBoxFor(m => m.Email, new { @class = "medium-editor" })
                @Html.ValidationMessageFor(m => m.Email)
            </div>

            <div class="editor-field">
                @Html.LabelFor(m => m.Password)            
                @Html.PasswordFor(m => m.Password, new { @class = "medium-editor" })
                @Html.ValidationMessageFor(m => m.Password)
            </div>

            <input type="submit" value="Entrar" />

            @Html.CheckBoxFor(m => m.RememberMe)
            @Html.LabelFor(m => m.RememberMe)

        </fieldset>
    </div>
}

<p>
    Esqueceu a sua password? 
    Clique @Html.ActionLink("aqui", "ForgotPassword", "Account") para recuperar a sua password. 
</p>
6
  • Post your code please Commented Aug 22, 2013 at 22:30
  • Code was added. Thanks for looking Commented Aug 23, 2013 at 17:20
  • Have you updated bundleConfig to show the upgraded versions of jQuery? If so I would suggest maybe there might be an error in the javascript since upgrade and once this falls over it leaves validation Commented Aug 23, 2013 at 18:17
  • Yes I updated jQuery versions and the bundleconfig is unchanged. New versions are now being used. I don't get any javascript errors and this code works if I remove the CheckBoxFor. If I revert to old jquery versions it works normally. Commented Aug 23, 2013 at 18:20
  • So basically the issue persists. Thanks Commented Aug 24, 2013 at 9:04

1 Answer 1

0

To solve this problem, include jquery migrate 1.2.x after jquery

<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
Sign up to request clarification or add additional context in comments.

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.