DHTMLX Docs & Samples Explorer

Forced validation

First column - min length 4
Second column - max length 15

Source
<link rel='STYLESHEET' type='text/css' href='../../codebase/dhtmlxgrid.css'>
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script src='../../codebase/dhtmlxcommon.js'></script>
<script src='../../codebase/dhtmlxgrid.js'></script>        
<script src="../../codebase/ext/dhtmlxgrid_validation.js" type="text/javascript" charset="utf-8"></script>
<script src='../../codebase/dhtmlxgridcell.js'></script>    
 
 
<div id="gridbox" style="width:350px;height:250px;background-color:white;overflow:hidden"></div>
<script>
dhtmlxValidation.isMin4 = function(a) {
    return a.length >= 4;
}
dhtmlxValidation.isMax15 = function(a) {
    return a.length <= 15;
}
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath('../../codebase/imgs/');
mygrid.setHeader("Column A, Column B");
mygrid.setInitWidths("100,250");
mygrid.setColAlign("right,left");
mygrid.setColTypes("ed,ed");
mygrid.enableValidation(true, true);
mygrid.setColValidators("Min4,Max15");
mygrid.setColSorting("int,str");
mygrid.enableMultiselect(true);
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.loadXML("../common/grid.xml", function() {
    mygrid.forEachRow(function(id) {
        mygrid.validateCell(id, 1);
    });
});
</script>