Hybrid View

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Sep 2009
    Location
    Taiwan
    Posts
    3
    Vote Rating
    0
    dianext is on a distinguished road

      0  

    Default TimeField maxValue and minValue validation does not work

    TimeField maxValue and minValue validation does not work


    Ext version tested:
    • Ext 3.3.3
    Browser versions tested against:
    • Chrome 31
    Description:
    • I set TimeField maxValue and minValue but it dose not work
    Steps to reproduce the problem:
    • Timefield setting
    Code:
    {
    fieldLabel:'Time',
    xtype:'timefield',
    minValue:'6:00 AM',
    maxValue:'9:00 AM'
    }
    • manual input 5:00 AM
    The result that was expected:
    • time field show invalid-mark
    The result that occurs instead:
    • time field does not show invalid-mark
    Solution:
    Code:
    
    
    Code:
    Ext.override(Ext.form.TimeField, {
    	/**
    	 * fix maxValue & minValue validation not work bug
    	 */
    	getErrors: function(value) {
    		var errors = Ext.form.DateField.superclass.getErrors.apply(this, arguments);
    
    
    		value = this.formatDate(value || this.processValue(this.getRawValue()));
    		if (value.length < 1) { // if it's blank and textfield didn't flag it then it's valid
    			return errors;
    		}
    
    
    		var svalue = value;
    		value = this.parseDate(value);
    		if (!value) {
    			errors.push(String.format(this.invalidText, svalue, this.format));
    			return errors;
    		}
    
    
    		var time = value.getTime();
    
    
    		if (this.minValue && time < this.minValue.getTime()) {
    			errors.push(String.format(this.minText, this.formatDate(this.minValue)));
    		}
    
    
    		if (this.maxValue && time > this.maxValue.getTime()) {
    			errors.push(String.format(this.maxText, this.formatDate(this.maxValue)));
    		}
    
    
    		if (this.disabledDays) {
    			var day = value.getDay();
    
    
    			for (var i = 0; i < this.disabledDays.length; i++) {
    				if (day === this.disabledDays[i]) {
    					errors.push(this.disabledDaysText);
    					break;
    				}
    			}
    		}
    
    
    		var fvalue = this.formatDate(value);
    		if (this.disabledDatesRE && this.disabledDatesRE.test(fvalue)) {
    			errors.push(String.format(this.disabledDatesText, fvalue));
    		}
    
    
    		return errors;
    	}
    });


  2. #2
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    4,082
    Vote Rating
    69
    Gary Schlosberg has a spectacular aura about Gary Schlosberg has a spectacular aura about Gary Schlosberg has a spectacular aura about

      0  

    Default


    Thanks for the report and override. Can you please post a runnable test case which reproduces the issue? Feel free to use our Fiddle:
    https://fiddle.sencha.com/#home


    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager:
    sheryl@sencha.com

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Location
    Taiwan
    Posts
    3
    Vote Rating
    0
    dianext is on a distinguished road

      0  

    Default


    Hi, Gray,

    Please try this, https://fiddle.sencha.com/#fiddle/2a1

    i
    f you input "5:00 AM" at first field(Ext 3.3 Original TImefiled), there is not display invalid msg.
    the same input works on Fixed Timefield.

Thread Participants: 1

Tags for this Thread