I’m just dipping my toes into Jquery form validation and have been following the online tutorial here.
When testing, the ‘Name’ and ‘Email’ validations work perfectly. The validation of the drop down list doesn’t though.
The script I’m trying to use is below, if anyone can spot what is wrong I’ll be eternally grateful.
<script type="text/javascript">
$(document).ready(function() {
$("#quote_form").validate({
rules: {
name: "required", // simple rule, converted to {required:true}
email: { // compound rule
required: true,
email: true
},
url: {
url: true
},
comment: {
required: true
}
},
messages: {
name: "Please enter your full name.",
email: "Please enter your email address."
}
});
});
jQuery.validator.addMethod(
"selectNone",
function(value, element) {
if (element.value == "none")
{
return false;
}
else return true;
},
"Please select an option."
);
$(document).ready(function() {
$("#quote_form").validate({
rules: {
budget: {
selectNone: true
}
}
});
});
</script>