javascript form validation - positioning
- by Holian
Dear Masters!
I have little snippet for validatin' my form. I need help to position the error messages, because now all message appear in the filed, so the user can't see it, and so its very annoying.
$(document).ready(function() {
jQuery.validator.addMethod("lettersonly", function(value, element) {
return this.optional(element) || /^[a-zoöüóúéáuí ]+$/i.test(value);
}, "<?php echo $lettersonly; ?>");
$("#regval").validate({
rules: {
name: {
required: true,
minlength: 5,
maxlength:30,
lettersonly: true
},
nick: {
required: true,
minlength: 3,
maxlength:12
},
pass1: {
required: true,
minlength: 5
},
pass2: {
required: true,
minlength: 5,
equalTo: "#pass1"
},
messages: {
full: {
required: ".....",
minlength: "....",
maxlength: "...."
},
nick: {
required: "....",
minlength: "....",
maxlength: "...."
},
pass1: {
required: "....",
minlength: "..."
},
pass2: {
required: "....",
minlength: "....",
equalTo: "...."
},
});
});
</script>