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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:44:19+00:00 2026-05-11T10:44:19+00:00

The following HTML form successfully utilizes jQuery’s form validation, displaying This field is required

  • 0

The following HTML form successfully utilizes jQuery’s form validation, displaying ‘This field is required’ to the right of the form field if left blank, and ‘Please enter at least 2 characters’ if fewer than 2 characters were entered. However, instead of the validation metadata being specified using the class and minlength attributes on the ‘cname’ form input field, I’d like to use jQuery’s ‘rules’ API instead, where the rules are specified in the body of the validate function. Thanks in advance:

    <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'                      'http://www.w3.org/TR/html4/loose.dtd'> <html> <head>   <script src='/lib/js/jquery.js'></script>   <script src='/lib/js/jquery.validate.js'></script>   <script>   $(document).ready(function(){$('#commentForm').validate(     /*      rules/messages here     */     );}     );   </script> </head> <body>   <form id='commentForm' method='get' action=''>  <fieldset>    <legend>A simple comment form with submit validation and default messages</legend>    <p>      <label for='cname'>Name</label>      <em>*</em><input id='cname' name='name' size='25' class='required' minlength='2' />    </p>    <p>      <input class='submit' type='submit' value='Submit'/>    </p>  </fieldset>  </form> </body> </html> 
  • 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. 2026-05-11T10:44:20+00:00Added an answer on May 11, 2026 at 10:44 am

    The examples contained in this blog post do the trick.

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

Sidebar

Related Questions

How easy is it to convert the following PHP form submission to an Ajaxy
I have a form with html browse type and a submit button. I chose
i have the following javascript file named coupon.js - jQuery(document).ready(function(){ jQuery('.appnitro').submit( function() { $.ajax({
I have a form that uses Ajax for client-side verification. The end of the
Using django-tinymce I have successfully embedded TinyMCE in the Admin before. Embedding it in
I am using php/ajax to submit a form without page refresh. Here are my
I am using php/ajax to submit a form without page refresh. Here are my
I'm upgrading from rails 2.3.8 to 3.0.0, so I need to replace the remote_form_for
(Sorry for long post) Ok guys, so I'm having some issues with something I'm
I have a page that loads a div from another page on successful submission

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.