Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Jan 24, 2008 12:36
open dhtmlx forum
Validation

mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../codebase/imgs/");
mygrid.preventIECaching(true);
mygrid.setOnRowSelectHandler(doOnRowSelected,true);
mygrid.init();
mygrid.loadXML("../Get.aspx",function(){mygrid.setColumnHidden(0,true);});
myDataProcessor = new dataProcessor("../Update.aspx");
myDataProcessor.setVerificator(3,checkIfNotZero);"+
myDataProcessor.setUpdateMode("off");
myDataProcessor.setTransactionMode("GET");
myDataProcessor.init(mygrid);
myDataProcessor.enableDebug(true);
mygrid1 = new dhtmlXGridObject('gridbox1');
mygrid1.setImagePath("../codebase/imgs/");
mygrid1.attachEvent("onEditCell",function(s,id,ind){
if (ind==13) return false;
return true;});
mygrid1.preventIECaching(true);
function doOnRowSelected(id){
var z=myDataProcessor.obj.getUserData(id,"!nativeeditor_status");
if (z=="inserted" || z=="deleted\" || z=="updated")
{return false;}
else {
myDataProcessor1 = new dataProcessor("../Select.aspx");
myDataProcessor1.setUpdateMode("off");
myDataProcessor1.setTransactionMode("GET");
myDataProcessor1.init(mygrid);
myDataProcessor1.enableDebug(true);
myDataProcessor1.setUpdated(id,true);
myDataProcessor1.sendData();
mygrid1.init();
mygrid1.loadXML("../Get1.aspx");}}
myDataProcessor2 = new dataProcessor("../Update1.aspx");
myDataProcessor2.setUpdateMode("off");
myDataProcessor2.setTransactionMode("GET");
myDataProcessor2.init(shiftgrid);
myDataProcessor2.enableDebug(true);
function checkIfNotZero(value,colName){
if(value.toString()._dhx_trim()==\"\"){
var msger = document.getElementById("messanger");
msger.innerHTML = colName+ " should not be empty";
return false;
}else return true;}

The validation function for the myDataProcessor() is not behaving as expected. when i click on the insert a new row button for some reason the validation function checkIfNotZero is being executed and the error message is being shown? what am i doing wrong here? how can i make the validation function to execute when the update (myDataProcessor.sendData()) button is clicked?
Answer posted by Support on Jan 25, 2008 02:32
By default validator run against updated row immideatly without waiting of data sending. You can disable such behavior by comment next line

dhtmlxdataprocessor.js ,. line 115

    dataProcessor.prototype.setUpdated = function(rowId,state,forceUpdate){
    ....
            this.setRowTextBold(rowId);
            ///this.checkBeforeUpdate(rowId,this.autoUpdate||forceUpdate);  << this line need to be commented

Commenting this line will not disable validation on sendData call