DHTMLX Docs & Samples Explorer

### Custom rules

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>

    <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: "Regexp [000-000]: ",
            value: "",
            validate: "^[0-9]{3}-[0-9]{3}$"
        }, {
            type: "input",
            name: "field_b",
            label: "Custom method [>100]: ",
            value: "",
            validate: "greaterThan"
        }];
        myForm = new dhtmlXForm("listObj", formData);
    }
    function greaterThan(data) {
        return data > 100;
    }</script>