Required fields

</> Source
<!DOCTYPE html>
<html>
<head>
	<title>Required fields</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: "", required: true},
				{type: "input", label: "Project Description", value: ""},
				{type: "input", label: "E-mail", name: "email", value: "", required: true, validate: "ValidEmail"},
				{type: "input", label: "Confirm e-mail", value: "", required: true, validate: "myFunc2"},
				{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);
		}
		function myFunc2(val) {
			return (val==myForm.getItemValue("email"));
		}

	</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.