Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Vijay on Mar 10, 2009 22:36
open dhtmlx forum
Validating Grid's price field.

Hi,

I would like to validate the price field in the grid. Currently, the grid line is allowing to enter non-numeric characters also in the price field. This should be validated and set the price as 0.00 when non-numeric value is entered in the grid line.

Note: The validation needs to be done on when editing a price cell in the line(by double clicking of the price cell) of the grid.

Thanks in advance for your help!

Answer posted by dhxSupport on Mar 11, 2009 02:33
You can use "onEditCell" method to check what value was entered into the cell:
mygrid.attachEvent("onEditCell",function(stage,rowId,cellId,newValue,oldValue){
if ((stage==2)&&(cellInd==0)){
//validate newValue
}
});
Answer posted by Vijay on Mar 17, 2009 22:13

Hi,

 

I used the below code provided by you. I facing a problem now, because of the below code.

You can use "onEditCell" method to check what value was entered into the cell:
mygrid.attachEvent("onEditCell",function(stage,rowId,cellId,newValue,oldValue){
if ((stage==2)&&(cellInd==0)){
//validate newValue
}
});
Problem is, when I use the above code, I couldnt check the checkbox in the same row. Its not allowing me to check the check box in the same row..
Please let me know the solution for this problem.
Answer posted by dhxSupport on Mar 18, 2009 02:29

Try to add "return true" to the event handler definition:

mygrid.attachEvent("onEditCell",function(stage,rowId,cellId,newValue,oldValue){

if ((stage==2)&&(cellInd==0)){

//validate newValue

return true;

}

return true;

});

Answer posted on Mar 18, 2009 03:06

Thanks for your reply...

Its working fine now...