ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: Syreta on March 20, 2019, 02:10:00 pm

Title: Inline Editing: Prevent regex validation when cell is empty
Post 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
Title: Re: Inline Editing: Prevent regex validation when cell is empty
Post by: paramvir on March 20, 2019, 09:04:14 pm
Callback function can be used in that case.

Code: [Select]
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;
}
}
                ]
Title: Re: Inline Editing: Prevent regex validation when cell is empty
Post by: Syreta on March 21, 2019, 11:33:41 am
Ah... I didn't notice that a callback function can be used for validation type.

Many thanks!  :D