From f98674b164324ced19c4ec07a35fc2d51081dbe8 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 8 Sep 2016 17:28:30 +0200 Subject: [PATCH] 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) --- api/js/etemplate/et2_widget_date.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_date.js b/api/js/etemplate/et2_widget_date.js index 1ffbbf1cd6..32fb2c3a3a 100644 --- a/api/js/etemplate/et2_widget_date.js +++ b/api/js/etemplate/et2_widget_date.js @@ -670,6 +670,12 @@ var et2_date_duration = (function(){ "use strict"; return et2_date.extend( "default": false, "type": "boolean", "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'); this.duration = jQuery(document.createElement("input")) .addClass('et2_date_duration') - .attr({type: 'number', size: 3}); + .attr({type: 'number', size: 3, step:this.options.step}); this.node.append(this.duration); if(this.options.display_format.length > 1)