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

  • Home
  • SEARCH
  • 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 9115683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:29:23+00:00 2026-06-17T04:29:23+00:00

I have got a simple signup form that uses jQuery validate to validate the

  • 0

I have got a simple signup form that uses jQuery validate to validate the contents of the form. but it doesnt seem to be working. My servlet fires and the form is submitted with invalid data regardless of the jQuery at the top of my page. Below is my code. Can anyone please help?

Script code:

<head>
    <title>Sign Up</title>
    <meta charset="iso-8859-1">
    <link rel="stylesheet" href="style/style.css" type="text/css">
    <!--[if lt IE 9]><script src="scripts/html5shiv.js"></script><![endif]-->
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.js" type="text/javascript">
    </script>
    <script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript">
    </script>
    <script type="text/javascript">
        $().ready(function() {
            // validate the comment form when it is submitted
            $("#signup").validate();

            // validate signup form on keyup and submit
            $("#signup").validate({
                rules: {
                    firstname: "required",
                    lastname: "required",
                    address1: "required",
                    city: "required",
                    county: "required",
                    postcode: "required",

                    password_s: {
                        required: true,
                        minlength: 5
                    },
                    password_s_con: {
                        required: true,
                        minlength: 5,
                        equalTo: "#password_s"
                    },
                    email: {
                        required: true,
                        email: true
                    },

                    agree: "required"
                },
                messages: {
                    firstname: "Please enter your first name",
                    lastname: "Please enter your last name",
                    address1: "Please enter your addres",
                    city: "Please enter your city/town",
                    county: "Please enter your county",
                    postcode: "Please enter your postcode",

                    password: {
                        required: "Please provide a password",
                        minlength: "Your password must be at least 5 characters long"
                    },
                    confirm_password: {
                        required: "Please provide a password",
                        minlength: "Your password must be at least 5 characters long",
                        equalTo: "Please enter the same password as above"
                    },
                    email: "Please enter a valid email address",
                    agree: "Please accept our policy"
                }
            });

        });
    </script>
</head>

The Form:

<table align="left">
<tr><td align="left">
        <form name="signup" id="signup" action="SignUpServlet" method="post">
            <table width="400px" align="right" class="">
                <fieldset>
                    <legend>Sign Up:</legend>
                    <tr>
                        <td>First Name:</td> <td><input type="text" id="firstname" name="firstname" required="required">*</td>
                    </tr>
                    <tr>
                        <td>Last Name:</td><td><input type="text" id="lastname" name="lastname" required="required">*</td>
                    </tr>
                    <tr>
                        <td>Address Line 1:</td><td> <input type="text" id="address1" name="address1" required="required">*</td>
                    </tr>
                    <tr>
                        <td>Address Line 2:</td><td> <input type="text" id="address2" name="address2"></td>
                    </tr>
                    <tr>
                        <td>City:</td><td> <input type="text" id="city" name="city" required="required">*</td>
                    </tr>
                    <tr>
                        <td>County:</td><td><input type="text" id="county" name="county" required="required">*</td>
                    </tr>
                    <tr>
                        <td>Postcode:</td> <td><input type="text" id="postcode" name="postcode" required="required">*</td>
                    </tr>
                    <tr>
                        <td>Phone:</td><td> <input type="text" id="phone" name="phone"></td>
                    </tr>
                    <tr>
                        <td>Email Address:</td><td> <input type="text" id="email_s" name="email_s" required="required">*</td>
                    </tr>
                    <tr>
                        <td>Password:</td><td> <input type="password" id="password_s" name="password_s" required="required"></td>
                    </tr>
                    <tr>
                        <td>Confirm Password:</td><td> <input type="password" id="password_s_con" name="password_s_con" required="required"></td>
                    </tr>
                    <tr>
                        <td>Privacy Policy:</td><td> <input type="checkbox" class="checkbox" id="agree" name="agree" required="required"></td>
                    </tr>
                    <tr>
                        <td></td><td>
                            <input type="submit" id="lf_submit" value="submit"></td>
                    </tr>
                </fieldset>
            </table>
        </form>
    </td></tr>
<tr><td align="left"> </td></tr>
</table>
  • 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-17T04:29:24+00:00Added an answer on June 17, 2026 at 4:29 am

    Firstly, you do not need to call .validate() twice. It’s redundant and superfluous, so remove the first one, and naturally keep the one that contains the options.

    $().ready(function() {
            // validate the comment form when it is submitted
            $("#signup").validate(); // <-- REMOVE THIS
    
            // validate signup form on keyup and submit
            $("#signup").validate({
    

    .validate() is called once within DOM Ready to initialize the form. All of the validation events such as submit, keyup, etc. are automatic unless you over-ride them in the plugin options.

    Secondly, you are incorrectly including jQuery after the plugin.

    No matter which jQuery plugins you use, jQuery ALWAYS needs to be included FIRST…

    <script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
    
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.js" type="text/javascript"></script>
    

    Working Demo of Your Code: http://jsfiddle.net/qUYvS/

    Documentation: http://jqueryvalidation.org/

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

Sidebar

Related Questions

I have got a Wavecom Supreme GSM modem. I wrote a simple application that
I'm trying to build the simple layout that I have got in the image
I have got a simple HTMl form with one field as follows: <input type=text
I know that I am missing something simple here. I have got this homework
I am working on login/signup module(FYI no rolls/membership just a simple login form),data flow
I have got a simple smyfony2 form with one choices element. When I choose
I am building a Space Invaders game. I have got a simple algorithm that
I have got a simple but strange problem. I am unable to set size
I have got a simple input tag <input type=text id=textb name=textbox/> jquery is $(document).ready(function(){
I have got a simple MySQL table and primary index (id) is not numbered

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.