views:

89

answers:

0

I am using client side validation. How can I disable submit button, then form is valid?

<script src="/content/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="/Content/js/MicrosoftAjax.js" type="text/javascript"></script>
<script src="/Content/js/MicrosoftMvcValidation.js" type="text/javascript"></script>


<fieldset>
    <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm("login", "account", FormMethod.Post)) { %>
    <ol>
        <li>
            <%= Html.LabelFor(model => Model.LoginOrEmail)%>
            <%= Html.TextBoxFor(model => Model.LoginOrEmail, new { @class = "text bigest", id = "login", tabindex = "1" })%>
            <%= Html.ValidationMessageFor(model => Model.LoginOrEmail)%>
        </li>
        <li>
            <%= Html.LabelFor(model => Model.Password)%>
            <%= Html.PasswordFor(model => Model.Password, new { @class = "text big", tabindex = "2" })%>
            <%= Html.ValidationMessageFor(model => Model.Password)%>
        </li>
        <li>
            <input class="button" type="submit" value="Login" tabindex = "4" />
        </li>
    </ol>
    <% } %>
    <script type="text/javascript">
        $('#login').focus();
    </script>