
October 16th, 2012, 06:24 AM
|
|
Contributing User
|
|
Join Date: Feb 2004
Posts: 202
Time spent in forums: 23 h 26 m 46 sec
Reputation Power: 10
|
|
JQuery Validation Plug-In: Need Help w/ Dropdowns
I'm trying to use the jQuery Validation plug-in on a form on my site. Two problems -- it doesn't seem to work and I want to use alert boxes for the errors.
Here's the code:
Code:
<script type="text/javascript">
jQuery.validator.addMethod(
"require_categories",
function(value, element) {
if (element.value == 0) {
return false;
} else {
return true;
},
"Please select an option."
});
$("#publishForm").validate({
rules: {
category: {
require_categories: true
}
}
});
</script>
<form id="publishForm" method="post">
<select name="category[]" id="county">
<option value="">--</option>
<option value="1">County Name</option>
...
</select>
</form>
Any ideas why this isn't working? And how do I configure it to use alert boxes as opposed to inline errors?
Thank you for your help.
|