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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:55:28+00:00 2026-06-05T19:55:28+00:00

This question most closely relates to the asp.net mvc3 framework. It started out as

  • 0

This question most closely relates to the asp.net mvc3 framework. It started out as “How can I ensure active validation for dynamically appended input fields using jQuery with asp.net mvc3?” However, after some searching, testing, and coffee I came across this:

function reValidate(formId) {
 $("#" + formId).removeData("validator");
 $("#" + formId).removeData("unobtrusiveValidation");
 $.validator.unobtrusive.parse("#" + formId);
}

This works just fine. However, I am more curious about the mechanism that the framework is actually using. I have a page which is entirely generated based on a script. The only thing in the view is a <div>, a <script> tag to load my library, and another <script> to populate the <div>. After rendering an entirely dynamic page, the validation is flawless. However, if the same process which was used when the page loads is used after the page was loaded to include some new content then the validation breaks. Sure, just call reValidate().

But –

a) How does the framework instantiate the validation once the page has loaded (or as it loads)?

b) Which part of the framework handles it? Is it the mvc3 part, the asp.net part, the razor engine, or another part?

  • 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-05T19:55:30+00:00Added an answer on June 5, 2026 at 7:55 pm

    a) How does the framework instantiate the validation once the page has
    loaded (or as it loads)?

    It parses the DOM, looks for data-* attributes on your input fields and adds the jquery.validate rules. jQuery validate is a client side validation plugin which has nothing to do with ASP.NET MVC and could be used with any server side framework or even with plain static HTML.

    b) Which part of the framework handles it? Is it the mvc3 part, the
    asp.net part, the razor engine, or another part?

    It’s the jquery.validate.unobtrusive.js script. The ASP.NET MVC helpers such as Html.TextBoxFor simply use the model metadata to generate input fields with the proper data-* attributes based on data annotations you used for your model. Those attributes contain all the necessary information in order to generate the native jquery validate rules. So the unobtrusive script makes the glue between the ASP.NET MVC Model metadata and the jquery.validate plugin. It’s the $.validator.unobtrusive.parse function that does this job. That’s the reason why you need to manually invoke it when you modify dynamically the DOM – you are adding/removing data-* attributes that need to be translated into jquery validate rules. Don’t hesitate to look at how it is implemented inside jquery.validate.unobtrusive.js.

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

Sidebar

Related Questions

<hyperbole> Whoever answers this question can claim credit for solving the world's most challenging
After reading this question ASP.NET MVC: Nesting ViewModels within each other, antipattern or no?
I realize this question has most likely been beaten to death, and that it's
I was asked this question recently in an interview : What is the most
While trying to answer this question I found without () (which invokes C++ most
Well, I'm learning Scala so this question may be too basic for most people.
This not a programming question but Most of the programmers using Eclipse should have
This is probably a trivial question for most but here goes... I am using
This may seems the most dumbest question ever on stackoverflow but I am just
I'm sure this is a question that is simple for most. I for some

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.