validation rule for select list with default value of '0'
I have a select list #technology. Due to some back end processing it's default value is "0" (Please Select) I am trying to write a validation rule to make it required. The problem I'm having is that if you hit submit when it shows "Please Select" which has the value="0" then make a different selection it's not removing the error msg. Also if you hit submit multiple times when it is showing Please Select it just keeps adding the error msg
here's what I have so far:
<script type="text/javascript">
$(document).ready(function() {
$.validator.addMethod(
"SelectTechnology",
function(value, element) {
//var selectedCountry = $('#Country').val();
if ($("#singleTech").val() === '0'){
return false;
} else return true;
},
"Please Select a Technology"
);
var validator = $("#SinglePmnt").validate({
rules: {
technology: {
SelectTechnology: true
}
},
errorElement: "span",
errorPlacement: function(error, element) {
error.appendTo(element.parent("td"));
}
});
});
</script>
Kane Leins