validating checkboxes using jquery in a jsp page

validating using jquery

Page 1 of 1

0 Replies - 2158 Views - Last Post: 13 December 2009 - 03:22 PM

#1 newbieal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-December 09

validating checkboxes using jquery in a jsp page

Posted 13 December 2009 - 03:22 PM

I've implemented jquery validation and successfully validates and points out the errors to the user. But the issue is, once I correct the error and click the button again, nothing happens. In firebug I see that it somehow wants to fire the second button's event instead (there's a second button on the jsp/html page). This is what I have:

$(document).ready( function() {
$("#myForm").validate({

rules : {
'otherField: { digits: true, min: 1 },
'checkBoxFields':{
required : {
depends: function(element) {
return $("#aChckBoxField:not(':checked')")
}
}

}
},
errorContainer: $("#warning, #summary"),
errorPlacement: function(error, element) {
//error.appendTo( element.parent("div").next("div") )
error.insertBefore("#checkBoxFields")
},
debug:true,
messages : {
otherFields: { digits: 'must be an integer', min: 'must be greater than 0' },
checkboxFields: "Select at least one box, please."

}
});

});


I have this button, that relates to the checkboxes:
<input type="submit" name="submit" value="Update" /> //<-- this used to contain the onclick event for the previous js validation function

This is the other button (not involved in any of the functionality above, it just launches a diff page):
<input type="button" value="Show page" onclick="window.location='somepage.do'"/>

I've added jquery's submit handlers but so far with the same result. Please help.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1