Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Anuj on Sep 02, 2008 23:29
open dhtmlx forum
Validation In DHTML Grid

I want validation in my grid.

if i add new row then existing row's cell cann't be blank.

if blank then alert comes and new row not added.

i also want only numeric values entered in cell3

Thanks & Regards
Anuj Sharma
Answer posted by Support on Sep 03, 2008 01:50
>>i also want only numeric values entered in cell3
mygrid.attachEvent("onEditCell",function(stage,id,ind,value){
  if (stage==2 && ind == 3 && (parseFloat(value)!=value) ) return false;
  return true; 
});

>>if blank then alert comes and new row not added.

var check = true;
mygrid.forEachRow(function(id){
    if (mygrid.cells(id,3).getValue=="") check = false;
})
if (check) mygrid.addRow(...