I made a regular expression to accept values from 0.0 to 10.0 and the letter F and with it I'm having problems, it ends up denying in the msg of AddMethod () itself.
<html>
<head>
<script src="jquery-2.0.3.js" type="text/javascript"></script>
<script src="jquery.validate.js" type="text/javascript"></script>
<script>
$(document).ready( function() {
//Método para verificar as horas com uso de expressão regular
$.validator.addMethod("nota", function(value, element) {
return this.optional(element) || /^(([F]{0-1})|((([1]{1}[0]{1})\.([0]{1}))|((([0]{1})(\d){1}))\.(\d{1})))?$/i.test(value);
}, "Por favor entre com uma nota válida.");
$("#formularioContato").validate({
// Define as regras
rules:{
nota:{
nota: "required nota",
required: true
}
},
messages:{
nota:{
required: "Digite uma nota válida ou o conceito F",
range: "O valor do dia deve estar entre 0.0 a 10.0 ou F"
}
}
});
});
</script>
<script src="jquery.maskedinput.js" type="text/javascript"></script>
<script>
jQuery(function($){
$("#nota").mask("*9.9");
});
</script>
</head>
<body><form id="formularioContato" method="post">
<div align="center">
<ul>
<li>
<label>Nota:</label><input type="text" id="nota" name="nota"></span><br />
</li>
</ul>
</div>
<input class="submit" type="submit" value="Enviar" />
</form>
</body>
</html>