Results 1 to 3 of 3

Thread: datefield.validator config option question

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2011
    Location
    Orem, UT
    Posts
    41
    Answers
    2

    Default datefield.validator config option question

    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:

    Code:
    {
        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!

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    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?

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2011
    Location
    Orem, UT
    Posts
    41
    Answers
    2

    Default

    Yes the missing bracket is a typo. Sorry about that.

    I am positive that the value check is evaluating correctly.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •