zabarb
#1
I see in the Validation Extension page (http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:validation_extension#basic_validators_assigning) that you can assign multiple validators to a single column
grid.setColValidators(["NotEmpty,ValidInteger","ValidEmail"]);
what I see when the column doesn’t pass the validation is that the event name is “NotEmpty,ValidInteger”. How do I know which validation failed?
I’m using v.2.6 build 100722 of the validaton extension, and unfortunately, upgrading our entire dhtmlx suite just isn’t an option right now.
sematik
#2
Unfortunately it’s not available to recognize what validation rule is not passed.
you may only find the column which is not passed.
zabarb
#3
What I ended up doing was something like this:
grid.attachEvent("OnValidationError", function(rId, cInd, newVal, evtName, oldVal){
var evtNames = evtName.split(",");
for (var i=0; i < evtNames.length; i++) {
if (!dhtmlxValidation.checkValue(newVal,evtNames[i], cell)) {
switch ( evtNames[i] ) {
case "blah":
//construct error mesage for event blah;
break;
case "foo":
//construct error mesage for event foo;
break;
}
//report error to user
return false;
}
and a similar routine in the OnValidationCorrect event
I really wish that the validation routine would also set an error object that held each event and whether it passed or failed validation:
validationEvents = {
"foo":true
"bar":false
};