JQuery form validation: standard box dialog when field is invalid
2 answers
You can try to mark all fields required for validation with the "RequiredField" class and then use Jquery to validate them right away. For those that don't work, you can add a selection class to turn them, say, red.
After that, you can show a warning that says the highlighted fields are invaild.
function CheckStandardInputs () {// Check the required fields. var ReqFields = $ (". RequiredField [value = '']");
if(ReqFields.size() > 0){
if(HighlightBlanks){
ReqFields.addClass("Highlight");
}
//Remove highlight on change.
ReqFields.change(function () {$(this).removeClass("Highlight");});
return false;
}else{
return true;
}
}
+2
a source to share