Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Velmurugant on Sep 06, 2009 23:28
open dhtmlx forum
Empty Validation on DHtmlxGrid using Dataprocessor?

Hi,
I want to check the empty fields in a column before clicking the save button in my grid. Actually it is mark the empty cells, But it is submitted. How do i prevent submittion? i am using th below code.

mygrid1.enableValidation(true,true);
mygrid1.setColValidators("NotEmpty");
function not_empty(value, id, ind)
{
if (value == "")
mygrid1.setCellTextStyle(id, ind, "background-color:red;");
return value != "";
}
mygrid1.setColumnIds("Issue,Code,Status,Action");
currentPage="saveinfo.php";
    myDataProcessor = new dataProcessor(currentPage);
myDataProcessor.setTransactionMode("POST", true);
//set mode as send-all-by-post;
myDataProcessor.setUpdateMode("off");
myDataProcessor.enableDataNames(true);
myDataProcessor.setVerificator(0, not_empty);
myDataProcessor.attachEvent("onRowMark", function(id)
{
if (this.is_invalid(id) == "invalid")
return false;
return true;
});
myDataProcessor.init(mygrid1);

function saveIssueDetails()
{
     //var str=mygrid1.serialize();
     //alert(str);
     myDataProcessor.sendData();
    
}

Please help me. what is the wrong with this? Once the data entered into the empty fields, the changed data should be sent to sever.


    
    

     myDataProcessor.init(mygrid1);
Answer posted by dhxSupport on Sep 07, 2009 03:08
Grid's validation extenstion isn't integrated with dataProcessor. You can use validation events and send data only if validation was passed. Please find more information here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:validation
Please find more information about dataProcessor's validation here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxdataprocessor:validation