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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:36:41+00:00 2026-06-05T23:36:41+00:00

I am trying to using a jquery.validate.unotrusive.js plugin to dynamically created form fields like:

  • 0

I am trying to using a jquery.validate.unotrusive.js plugin to dynamically created form fields like:

var message = $("<textarea id='test'></textarea>");
$(message).attr("data-val", "true")
.attr("data-val-number", "The field CustomerId must be a number.")
.attr("data-val-required", "The CustomerId field is required.");

var span = $('<span class="field-validation-valid" data-valmsg-replace="true"></span>');
$(span).attr("data-valmsg-for", $(message).attr("id"));

var form = $("<form action='url'></form>");

$(form).append(message,span);

I embed both jquery.validate & jquery.validate.unobtrusive js files but textarea field is not validate on form submission. Can anybody tell whats going wrong here?

  • 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-05T23:36:44+00:00Added an answer on June 5, 2026 at 11:36 pm

    When you add new elements to the DOM dynamically you will need to reparse the unobtrusive validation rules in order to register them. So once you have appended the form to the DOM invoke the $.validator.unobtrusive.parse method to inform the client validation framework of those changes:

    ...
    $(form).append(message, span);
    $.validator.unobtrusive.parse(form);
    

    And if you are only dynamically adding input elements to an already existing form in the DOM for which the client side validation has been registered you will also need to remove previous rules for this form:

    // adding some form elements to an existing form ...
    
    $(form).removeData('validator').removeData('unobtrusiveValidation');
    $.validator.unobtrusive.parse(form);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to validate a form using jquery validate plugin and I'm having a
I am trying to validate username field in my form using jquery validation plugin.
I'm using the validate plugin from http://bassistance.de/jquery-plugins/jquery-plugin-validation/ What i'm trying to find is a
I am trying to validate html select element using jQuery Validate plugin. I set
I'm using the jQuery validate plugin, and would like to return a random value
I am trying to validate my form using jquery but I cannot get it
I am trying to validate a form, using jQuery validate and show errors messages
I'm using this jQuery validation plugin and getting the famous: $(#Form).validate is not a
i am trying to validate a form text box using jquery validator, it works
I have the following form. I am trying to validate the inputs using jquery

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.