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

Ask A Question

Stats

  • Questions 122k
  • Answers 122k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I did this in the past with a Java Applet.… May 12, 2026 at 12:38 am
  • Editorial Team
    Editorial Team added an answer There's no way to tell the difference, with Reflection or… May 12, 2026 at 12:38 am
  • Editorial Team
    Editorial Team added an answer You could do this with a TemplateField instead... <asp:TemplateField> <ItemTemplate>… May 12, 2026 at 12:38 am

Related Questions

The following HTML form successfully utilizes jQuery's form validation, displaying This field is required
In my Review model, I have the following: class Review < ActiveRecord::Base belongs_to :vendor
I'm very new to the AJAX and Javascript world and I'm trying to implement
I've been adding xVal to the NerdDinner app - so far so good, I
A few weeks ago I opened up a hole on my shared server and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.