<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxform_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxform.js"></script>
<form action="" method="post" accept-charset="utf-8" id="my_form" onsubmit="return myForm.validate();">
<div id="listObj" style="position: relative; width: 250px;"></div>
<input type="submit" value="Validate">
</form>
<script>function doOnLoad() {
var formData = [{
type: "input",
name: "field_a",
label: "User name: ",
value: "",
validate: "NotEmpty"
}, {
type: "input",
name: "field_b",
label: "Email: ",
value: "",
validate: "ValidEmail"
}];
myForm = new dhtmlXForm("listObj", formData);
myForm.attachEvent("onValidateError", function(obj, value, res) {
obj.style.color = "navy";
obj.style.fontWeight = "bold";
});
myForm.attachEvent("onValidateSuccess", function(obj, value, res) {
obj.style.color = "green";
obj.style.fontWeight = "bold";
});
}
</script>