html - Problem with form validation using jquery validate plugin -


i have following code perform validation of submitform shown below .when click on addresslisting div tag , call validation function ,it performs validation businessname field not other remaining feilds.only businessname name field highlighted in red color,but not other feilds. using following jquery plugin validate fields http://jquery.bassistance.de/validate/jquery.validate.js

example.html

<fieldset id="fieldset1"> <legend>registration details:</legend>                <form id="submitform">                 name of business:<br/>                   <input size="30" type="text" id="businessname" class="required" /><br/>                                zipcode:<br>                   <input size="30" type="text" id="zipcode"  class="required zipcode"/><br>                               telephone:<br/>                   <input size="30" type="text" id="telephone"  class="required phone" /><br/>                 email:<br/>                   <input size="30" type="text" id="email"  class="required email"/>                      </fieldset>                   <br/>                 email user name:<br/>               <input size="30" type="text" id="username" class="required"/><br/>                 choose password:<br/>               <input size="30" type="text" id="pass" class="required password" class="required"/><br/>                 retype password:<br/>               <input size="30" type="text" id="pass1" equalto="#pass"/><br/>                         <input id="addresslisting" type="image" src="images/submit.png" align="left"  />                                   </form>   </feildset> 

example.js

$(document).ready(function() {      $("#addresslisting").click(function() {     $("#addresslistingform").validate(); });  }); 

example.css

label { width: 10em; float: left; } label.error {  color: red; padding:8px 200px 0px 0px; vertical-align: top; float:right;  background:url("unchecked.gif") no-repeat 120px 0px;      } input.error {border:1px solid red;} input.errorlist {margin:0; color: red; margin-bottom:10px;} #fieldset1 { border: 1px solid #1f76c8; width: 500px; margin:5px; padding:10px 15px 5px 15px; }    

edit 2 missing name attributes on form fields. have working here: http://jsfiddle.net/3aphy/

$(document).ready(function() {      $("#addresslisting").click(function() {         $("#submitform").validate();     });  }); 

aren't validating wrong this? shouldn't submitform?

edit if above doesn't work, try:

$(document).ready(function() {     $("#submitform").validate();      $("#addresslisting").click(function() {         $("#submitform").submit();     }); }); 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -