If you don't want to use HTML5 required attribute or Mootool's More validation providers (inline validation) than you can do something simple like assigning all required input[type=text] elements and input[type=checkbox] elements
class="required"
and then do something like this:
$('emeraldForm').addEvent("submit",function(evt){
var preventSubmission = false;
$(this).getElements("input[type=text].required").each(function(elem) {
if (elem.get("value").trim() == "") {
elem.addClass("error");
preventSubmission = true;
}
});
$(this).getElements("input[type=checkbox].required").each(function(elem) {
if (!elem.get("checked")) {
elem.addClass("error");
preventSubmission = true;
}
});
if (preventSubmission) {
evt.preventDefault();
}
});
I am adding class error which can be in CSS specified as red background or some icon next to input element or similar attention drawing thing.