DHTMLX Docs & Samples Explorer

Required Fields

Source
<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>
    <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> <div id="myForm" style="height:510px;"></div>