Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rajendra on Jul 02, 2009 23:33
open dhtmlx forum
E-mail validation

hiii
I am using Dhtmlx grid 2.1. I want to validate the email field such that only email value should be accepted in the cell. This is the code I am using so please help me out
<script type="text/javascript" language="javascript">    
     mygrid = new dhtmlXGridObject('gridbox');
     mygrid.imgURL = "imgs/";
     mygrid.setHeader("Hotel,Room,Country,E-mail");
mygrid.attachHeader("#rspan,#rspan,#rspan,#rspan");
mygrid.setInitWidths("50,50,50,50");
mygrid.setColAlign("left,left,left,left");
mygrid.setColTypes("ro,ed,ed,ed");
mygrid.setMathRound(0);
mygrid.enableMathEditing(true);
mygrid.setColSorting("str,str,str,str");
mygrid.setSkin("light");
     mygrid.loadXML("grid.xml");
mygrid.init();
</script>
I want the E-mail field validation

Rajendra Bhattacharya
P I Infosoft Private Limited
63 A, Ber Sarai
New Delhi - 110016
Mobile: 9990855016
Tel: 11-26536766
Answer posted by dhxSupport on Jul 06, 2009 01:00
DhtmlxGrid version 2.1 hasn't inbuild functionality wich allow you validate cell's values automatically. But you can use "onEditCell" event to check what value was inserted to the cell:
mygrid.attachEvent("onEditCell",function(stage,rowId,cellIndex,newValue,oldValue){
if (stage==2&&cellIndex==3){
//your validation code here
//newValue - new inserted cell's value
}
return true;
});