ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: Syreta on March 20, 2019, 02:10:00 pm
-
Hello,
I'm using a regex validation for a date field when editing a cell with date value. Is it possible to prevent the validation when the value of the cell is empty?
Thanks,
Syreta
-
Callback function can be used in that case.
validations: [
{
type: function(ui){
var val = ui.value;
// if empty or correct date format.
if( !val || /^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/.test(val) ){
return true;
}
ui.msg = 'Not in mm/dd/yyyy format';
return false;
}
}
]
-
Ah... I didn't notice that a callback function can be used for validation type.
Many thanks! :D