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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:42:35+00:00 2026-06-16T15:42:35+00:00

I have this code below which validates a form. However, there is a bug

  • 0

I have this code below which validates a form. However, there is a bug in this code. When I enter something in username and leave the password blank, the form accepts it. It shouldn’t be accepting it. Any idea why?

<html> 

     <head>  <link type = "text/css" type="text/javascript" rel="stylesheet" href="css/bootstrap.css" />
              <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
       <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>

       <script src="js/bootstrap.js"> </script>
     <script> 
       $(document).ready(function() {
    $('form').validate({
        submitHandler: function(form) { // for demo
            alert('valid form');
            return false;
        }
    });
});</script>
     </head> 


 <body> 
<form class="well span6"> 

     <label>Username</label> 
     <input type="text" id="myName" class="span3 required" placeholder="Type your username here..." />  <br/> 

      <label>Password</label> 
     <input type="text" id="myPassword" class="span3 required" placeholder="Type your password here..." /> <br/> 

     <input type="submit" class ="btn btn-primary">
     <!-- <button class=""> Clear <br/></button><br/> -->

</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. Editorial Team
    Editorial Team
    2026-06-16T15:42:37+00:00Added an answer on June 16, 2026 at 3:42 pm

    I’m pretty sure this validation plugin like a ‘name’ attribute on the field.

    I’ve added name="myName and name="myPassword on each input and it seems to work in this jsfiddle

    <form class="well span6">    
         <label>Username</label> 
         <input name="myName" type="text" id="myName" class="span3 required" placeholder="Type your username here..." /><br/> 
    
          <label>Password</label> 
         <input name="myPassword" type="text" id="myPassword" class="span3 required" placeholder="Type your password here..." /><br/> 
    
         <input type="submit" class="btn btn-primary">
    </form> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a code like this below, which gives me a $link that equals
I have a code below where it contains a form which contains text inputs
I have the following code which I'm using to populate form fields. This code
I have this code below. I need to use a class id instead of
I have this code below. As you can see I am passing two variables
I have this code below: $insert = array(); for ($i = 1, $n =
I have this javascript code below that uses jquery, it is suppoed to be
I have this below code and it work fine header (content-type: text/xml); $xml =
I have this snippet of code below. I want to pass the value of
I have this kind of code below, how can I bind the visibility of

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.