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

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> 
  • 0 0 Answers
  • 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 96k
  • Answers 96k
  • 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 You can get a list of all compiler warnings by… May 11, 2026 at 7:07 pm
  • Editorial Team
    Editorial Team added an answer First of all, the stomach would be included in the… May 11, 2026 at 7:07 pm
  • Editorial Team
    Editorial Team added an answer The hook_form_alter hook can be used to modify the appearance… May 11, 2026 at 7:07 pm

Related Questions

The following HTML form successfully utilizes jQuery's form validation, displaying This field is required
A few weeks ago I opened up a hole on my shared server and
I am generating the following html form with this php: echo <form name=\userForm\> Username:
I am having problems with MVC RC2 where upon validation failure, the failed field
For the following HTML: <form name="myForm"> <label>One<input name="area" type="radio" value="S" /></label> <label>Two<input name="area" type="radio"

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.