DHTMLX Docs & Samples Explorer

### Validation API

Bind command [>100]: Bind command [>100, <1000]:
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>
    <style>
    .dhxlist_obj_dhx_skyblue label{
        color:#000000;
        font-family:Tahoma;
        font-size:11px;
    }
    .dhxlist_obj_dhx_skyblue .dhxlist_txt_textarea, input.dhtmlx_validation_error{
        border: 1px solid #A4BED4;
        padding: 1px 0;
    }
    </style>

    <form action="" method="post" accept-charset="utf-8" id="my_form" >
        <label>Bind command [&gt;100]: </label><input  class="dhxlist_txt_textarea" type="text" name="fieldA" id="fieldA" value="">
        <label>Bind command [&gt;100, &lt;1000]: </label><input class="dhxlist_txt_textarea" type="text" name="fieldB" id="fieldB" value="">
        <input type="button" command="validate" value="Validate">
    </form>
    <script>my_form_obj = new dhtmlXForm("my_form");
    function greaterThan(data) {
        return data > 100;
    }
    function lesserThan(data) {
        return data < 1000;
    }
    my_form_obj.bindValidator("fieldA", "greaterThan");
    //there is possibility to bind 2 commands to one input;
    my_form_obj.bindValidator("fieldB", "greaterThan");
    my_form_obj.bindValidator("fieldB", "lesserThan");</script>