Results 1 to 3 of 3

Thread: How can I force user only select dates until yesterday?

  1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    130

    Question How can I force user only select dates until yesterday?

    How can I force user only select dates until yesterday? using date field


    Ext.apply(Ext.form.VTypes, {
    daterange : function(val, field) {
    var date = field.parseDate(val);

    if(!date){
    return false;
    }
    if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
    var start = Ext.getCmp(field.startDateField);
    start.setMaxValue(date);
    start.validate();
    this.dateRangeMax = date;
    }
    else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
    var end = Ext.getCmp(field.endDateField);
    end.setMinValue(date);
    end.validate();
    this.dateRangeMin = date;
    }
    /*
    * Always return true since we're only using this vtype to set the
    * min/max allowed values (these are tested for after the vtype test)
    */
    return true;
    }
    });

  2. #2
    Sencha User Screamy's Avatar
    Join Date
    Jun 2008
    Posts
    244

    Default

    Take a look at Ext.form.DateField.maxValue, it may save you some code.

    Thx.

  3. #3
    Sencha User laurentParis's Avatar
    Join Date
    Aug 2010
    Location
    paris
    Posts
    246

    Default

    I suggest to you :

    don't use xxxx.validate() but xxxx.markInvalid(myErrorMsg); or clearInvalid()
    problem is when you have two dates with vtype, validate function call vtype, vtype call validate...etc infinite cycle !

Similar Threads

  1. after yesterday's webinar
    By Christiand in forum Ext Designer: Help & Discussion
    Replies: 2
    Last Post: 7 Oct 2010, 9:44 AM
  2. Restricting User to select more than one column
    By smruti_patra in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 12 Aug 2008, 12:54 AM
  3. User-entered dates are case sensitive
    By AdamDawes in forum Ext 1.x: Help & Discussion
    Replies: 11
    Last Post: 8 Sep 2007, 7:39 AM
  4. DateField how to disable dates from yesterday
    By thameema in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 23 Mar 2007, 8:24 AM

Posting Permissions

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