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 8750229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:49:48+00:00 2026-06-13T12:49:48+00:00

I have a HTML form that uses unobtrusive validation in my website which is

  • 0

I have a HTML form that uses unobtrusive validation in my website which is an ASP.Net MVC4 application. The form from my view is simple and is shown below

@Using (Html.BeginForm())
{
  @: Listing for @ViewBag.itemNumber
  @Html.TextBoxFor(model=>model.Name)
  @Html.TextBoxFor(model=>model.Location)
  @:<input type="submit" value="Save" />
}

My controller is as shown below

public ActionResult test()
{
  string itemNumber = Request.params["item"];
  ViewBag.itemNumber = itemNumber;
  return View();
}

and my model is

public class item
{
 [StringLength(10, ErrorMessage = "The Name should be atleast 3 characters in length", MinimumLength = 3)]
 public string Name {get;set;}
 public string Location {get;set;}
}

The problem I am having is that the unobtrusive validation kicks in as soon as the page loads even before my first form submit. The textbox for Name turns red as soon as I start typing because of the minimum length validation. I have used unobtrusive validation successfully and without this issue on other pages of the same website. I suspect that the validation is kicking in early on this particular page because of the code in my controller which retrieves a value from the URL GET parameters and sets it in the Viewbag. Is my assumption correct? If it is, how can I prevent the validation from starting too early on this page?

EDIT: I have the following javascript libraries on my page in the same order as specified below

<script src="~/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery-ui-1.9.0.min.js" type="text/javascript"></script>
<script src="~/Scripts/jQuery.tmpl.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
  • 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-06-13T12:49:49+00:00Added an answer on June 13, 2026 at 12:49 pm

    The one you described is the default behaviour! Fields are validated also onKeyUp as default. This doesn happens with required fields simply because when the key is up the textbox is not empty anymore! So maybe you are confused with the behaviour of the required field case.
    Anyway you can disable the keyUp validation. See here the full options of the plugin you can change : http://docs.jquery.com/Plugins/Validation/validate#toptions

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

Sidebar

Related Questions

We have a ASP.NET MVC 3 application that uses unobtrusive jQuery validation. The page
Hello is it possible to have an ASP.NET MVC form that uses the routes
Hey all, I have an HTML form on my website which currently only uses
I have a HTML form that has certain fields which i am opening inside
I have a HTML form that accepts a comma separated list of tags, which
I have an HTML form that uses a PHP file in the form tag
I have a standard html form that uses a background image. I would like
I have a simple HTML form that uses uses ajax in part of the
I have a single page application written in MVC4 that uses pjax() to push
I've been working on an ASP.net MVC project that uses checkbox HTML Helpers in

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.