Implement step attribute for date_duration widget. Seems FF needs step to be set to be able to distinguish valid or invalid decimal input format (eg. 1.5 or 1,5)

This commit is contained in:
Hadi Nategh 2016-09-08 17:28:30 +02:00
parent 7442bff49c
commit 8472cc4186

View File

@ -670,6 +670,12 @@ var et2_date_duration = (function(){ "use strict"; return et2_date.extend(
"default": false, "default": false,
"type": "boolean", "type": "boolean",
"description": "use d/h/m instead of day/hour/minute" "description": "use d/h/m instead of day/hour/minute"
},
"step" : {
"name": "Step limit",
"default": 'any',
"type": "string",
"description": "Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set."
} }
}, },
@ -716,7 +722,7 @@ var et2_date_duration = (function(){ "use strict"; return et2_date.extend(
.addClass('et2_date_duration'); .addClass('et2_date_duration');
this.duration = jQuery(document.createElement("input")) this.duration = jQuery(document.createElement("input"))
.addClass('et2_date_duration') .addClass('et2_date_duration')
.attr({type: 'number', size: 3}); .attr({type: 'number', size: 3, step:this.options.step});
this.node.append(this.duration); this.node.append(this.duration);
if(this.options.display_format.length > 1) if(this.options.display_format.length > 1)