Live validation
</> Source
<!DOCTYPE html>
<html>
<head>
<title>Live validation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
<script src="../../../codebase/dhtmlx.js"></script>
<script>
var myForm, formData;
function doOnLoad() {
formData = [
{type: "settings", position: "label-left", labelWidth: 130, inputWidth: 160},
{type: "label", label: "New project"},
{type: "input", label: "Project Name", value: "", validate: "NotEmpty"},
{type: "input", label: "Project Description", value: "", validate: "NotEmpty"},
{type: "input", label: "E-mail", value: "", validate: "NotEmpty,ValidEmail"},
{type: "select", label: "User Type", validate: "myFunc", options:[
{value: 0, text: ""},
{value: 1, text: "User"},
{value: 2, text: "Power User"},
{value: 3, text: "Mega User"},
{value: 4, text: "Administrator"}
]},
{type: "button", value: "Submit"}
];
myForm = new dhtmlXForm("myForm", formData);
myForm.enableLiveValidation(true);
myForm.attachEvent("onButtonClick",function(){
myForm.validate();
});
}
function myFunc(val) {
return (val > 0);
}
</script>
</head>
<body onload="doOnLoad();">
<div id="myForm" style="height:510px;"></div>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.