Hello,
I’m using DhtmlxPRO version.
We are useing XML serialized grid, to send/receive information to the server.
I need to have some client side validations (mostly not empty, and data types).
We are actually using:
myGrid.enableValidation(true,true,true,);
myGrid.setColValidators(“NotEmpty,NotEmpty,”);
And works correctly, but I have 2 questions:
1) With this example, can I add more than one validation per column? Or are these validations added automatically?
If I want a column NOT to be validate as “NotEmpty” but if some data is inserted, YES to be validated by ValidInteger?
2) I want to use something similiar to Dataprocessor’s “checkBeforeUpdate” function,
Like this:
for (var i=0; i<myDataProcessor.updatedRows.length; i++){
valid&=myDataProcessor.checkBeforeUpdate(myDataProcessor.updatedRows[i]);
}
Can I use anything else in particular, without using DataProcessor?
Thanks in advanced,
Andres
With this example, can I add more than one validation per column?
Yep, you can use next syntax
myGrid.setColValidators([“NotEmpty,ValidEmail”,“NotEmpty”,""]);
In such case first column will have two validation rules
>>to be validate as “NotEmpty” but if some data is inserted, YES to be validated by ValidInteger
You can use ValidInteger, because it already requires that value must be non-empty
>>2) I want to use something similiar to Dataprocessor’s “checkBeforeUpdate” function
var result = true;
grid.forEachRow(function(id){
if (!grid.validateCell(id, INDEX))
result=false;
});
Thanks Stanislav for your response:
Just one more question:
On point 1:
Previous question: "If I want a column NOT to be validate as “NotEmpty” but if some data is inserted, YES to be validated by ValidInteger?
"
I want a value to be validated (for example as integer) but ONLY if the data is inserted, This field CAN be empty.
How can I do this?
Thanks in advanced!
Andres
It can’t be achieved by existing validation rules. But you can implement your own validation function which will check value against empty and after at confirm if it valid integer or not.
dhtmlx.com/dhxdocs/doku.php?id=d … _extension
Ok, Thanks a lot for your responses!