PDA

View Full Version : datefield.validator config option question



hghubert
21 May 2014, 2:16 PM
Greetings,

I am using ExtJs 4.2 to input a start and end date range. Both these fields use the default format 'm/d/Y'. I have these fields working and validating properly in the current release. I just got a feature request to have these fields also accept '*' as valid input as a wildcard character.

The trouble I am having is getting the validation working with this. In consulting the documentation for datefield I found the validator config option which says it will allow the devloper to override the default validation process. I have implemented this config and return true in the case of a * as shown:


{
xtype: 'datefield',
cls: 'js_query_date_start',
format: 'm/d/Y',
validator: function(value){
if(value === '*'){
return true;
}
},

The trouble is that it does not seem to have any effect as the default validation still happens and it says "* is not a valid date - it must be in the format of m/d/Y"

Any one have any other thoughts on how to get this to work?

Did I read the documentation wrong or is it incorrect?

Thanks in advance!

Gary Schlosberg
23 May 2014, 3:17 PM
I'll assume the missing bracket is a typo in this post only. Returning 'true' should cause the field to pass validation. Are you sure the value check is evaluating correctly?

hghubert
23 May 2014, 5:09 PM
Yes the missing bracket is a typo. Sorry about that.

I am positive that the value check is evaluating correctly.