Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Jan 07, 2010 22:11
open dhtmlx forum
date validation

Hello,

i my grid contain two dates start and end and i want to give validation that end date is not less than start date isit possible in dhtmlxgrid .

i m giving like this but its not work

if(column_index==12)
{

mygrid.attachEvent("onChange", function(){
            alert("sssss");
             var sdate = this.cells(row_id,11).getValue();
             alert(sdate);
             var edate = this.cells(row_id,12).getValue();
            alert(edate);
         if(edate<sdate)
                {
                     alert("End Date must be greater than start date!")
                    this.cell.style.backgroundColor="yellow";
                    return false;
                }
                
                })
        
    }


please tell me wht i do to apply validation for this

regards
Suraj
Answer posted by Alex (support) on Jan 11, 2010 07:21

Hello,

you can use onEditCell event to validate values:

http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:event_oneditcell

grid.attachEvent("onEditCell", function(stage,rId,cInd,nValue,oValue){

if(stage ==2){

   if(...) return false;

}

return true;

})