Results 1 to 3 of 3

Thread: TimeField maxValue and minValue validation does not work

Hybrid View

Previous Post Previous Post   Next Post Next Post
    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
      0  

    Default 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
    10,378
    Vote Rating
    263
      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

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Location
    Taiwan
    Posts
    3
    Vote Rating
    0
      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.

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
  •