Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 796049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:34:47+00:00 2026-05-14T22:34:47+00:00

In VS2010 and ASP.NET MVC 2, it seems that client-side validation (JQuery Futures or

  • 0

In VS2010 and ASP.NET MVC 2, it seems that client-side validation (JQuery Futures or the stock option) doesn’t quite work as advertised.

I’m noticing that “tabbing off” a validated element will not invoke the client-side validation as promised. For a required field, you have to tab into the element, enter something, then remove it completely, in order to trigger the required validation. That’s not really what I’m after here, and I’m hoping it’s just a configuration issue on my side.

How do I get the validation effects from previous versions so that a previous value isn’t necessary (without having to modify the client-side scripts if possible)?

For those that asked here is a bit of a sample of what I’m doing on the client-side.

 <div>
    <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm("Signup", "Home", new { area = "Admin" }, FormMethod.Post, new { id = "create_account_form", action = "#" })) { %>
        <fieldset>
            <div>
                <table>
                     <tr>
                        <td><label for="Email"> Email</label></td>
                        <td><%= Html.TextBoxFor(m => m.Email, new { name = "Email", @class = "textfield" }) %></td>
                        <td colspan="2"><p class="hint"><%= Html.ValidationMessageFor(m => m.Email)%></p></td>
                    </tr>
                    <tr>
                        <td><label for="Company"> Company</label></td>
                        <td><%= Html.TextBoxFor(m => m.Company, new { name = "Company", @class = "textfield" })%></td>
                        <td colspan="2"><p class="hint"><%= Html.ValidationMessageFor(m => m.Company)%></p></td>
                    </tr>
                </table>
            </div>
        </fieldset>
    <% } %>     

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:34:48+00:00Added an answer on May 14, 2026 at 10:34 pm

    I can confirm that it does work when ‘tabbing off’ an element, but it appears to be an issue with specific types of validation annotations.

    It appears that if you have the [Required] attribute, then the validation isn’t triggered if you just tab through the corresponding input.

    If you have a [RegularExpression] then this is triggered when you tab out.

    My suspicion is that the validation is triggered by a combination of theonechange and blur events. This would explain why the regular expression is able to be validated (as it has changed), but not the required test.

    This is my view model:

        [Required(AllowEmptyStrings = false, ErrorMessage = "Please enter a first name")]
        [StringLength(50, ErrorMessage = "Maximum of 50 characters")]
        public string FirstName { get; set; }
    
        [Required(AllowEmptyStrings = false, ErrorMessage = "Please enter a last name")]
        [StringLength(50, ErrorMessage = "Maximum of 50 characters")]
        public string LastName { get; set; }
    
        [Required(AllowEmptyStrings = false, ErrorMessage = "Please enter a unique email address")]
        [CustomValidation(typeof(User), "ValidateUniqueEmailAddress")]
        [StringLength(255, ErrorMessage = "Maximum of 255 characters")]
        [RegularExpression(EmailRegEx, ErrorMessage = "Invalid email address entered")]
        public string EmailAddress { get; set; }
    

    and the HTML code.

    <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm())
       {%>
    <%: Html.ValidationSummary(true) %>
    <fieldset class="colLeft">
        <legend>Required Fields</legend>
        <div class="editor-label">
            <%: Html.LabelFor(model => model.FirstName) %>
        </div>
        <div class="editor-field">
            <%: Html.TextBoxFor(model => model.FirstName) %>
            <%: Html.ValidationMessageFor(model => model.FirstName) %>
        </div>
        <div class="editor-label">
            <%: Html.LabelFor(model => model.LastName) %>
        </div>
        <div class="editor-field">
            <%: Html.TextBoxFor(model => model.LastName) %>
            <%: Html.ValidationMessageFor(model => model.LastName) %>
        </div>
        <div class="editor-label">
            <%: Html.LabelFor(model => model.EmailAddress) %>
        </div>
        <div class="editor-field">
            <%: Html.TextBoxFor(model => model.EmailAddress) %>
            <%: Html.ValidationMessageFor(model => model.EmailAddress) %>
        </div>
    

    As you can see, nothing fancy.

    In this case, when you tab through all of the inputs (first name, last name, email address), then the [Required] validation is not triggered on any of them. If you input an invalid email address then tab out, the [RegularExpression] validation is triggered.

    It seems like a bug/feature of one of the validation libraries.

    NOTE: I tested this in VS 2010 as I don’t have access to VS 2008, but I can’t see how this would be any different in the 2 versions as the code is exactly the same between them. I also used Google Chrome.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ASP.NET MVC2 project in VS2010 that can be deployed in two
Recently, I was trying to prototype some jQuery-based menu into ASP.NET MVC. Just to
I'm using VS2010, ASP.NET MVC 2, and ReSharper 5.0. When I create a new
I'm trying to deploy an ASP.NET MVC 2 app using MsDeploy. I use VS2010
Is there any workaround on installing asp.net mvc 2 beta on a VS2010 Beta2
VS2010 Ultimate, ASP.NET MVC 3 w/Razor. I've created a custom view engine in my
we have a Asp.Net MVC 2.0 application. In Vs2010 solution Explorer there is only
I work in VS2010, ASP.NET MVC 2 project. The project was completed, it remains
I am following http://www.mikesdotnetting.com/Article/125/ASP.NET-MVC-Uploading-and-Downloading-Files . Using VS2010, ASP.NET 4.0, MVC3 in C# with ADO.NET
I am having trouble running my asp.net mvc 2 app. using VS2010 ASP.NET Development

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.