diff --git a/api/js/etemplate/et2_widget_date.js b/api/js/etemplate/et2_widget_date.js index 56fb6518d4..6771ffacd3 100644 --- a/api/js/etemplate/et2_widget_date.js +++ b/api/js/etemplate/et2_widget_date.js @@ -142,8 +142,26 @@ var et2_date = /** @class */ (function (_super) { this.set_value(null); } }; + /** + * Calendar popup sets the ID of the input, we can't change that like other inputWidgets can + * + * @param _value + */ + et2_date.prototype.set_id = function (_value) { + this.id = _value; + this.dom_id = _value && this.getInstanceManager() ? this.getInstanceManager().uniqueId + '_' + this.id : _value; + var node = this.getDOMNode(this); + if (node) { + if (_value != "") { + node.setAttribute("id", this.dom_id); + } + else { + node.removeAttribute("id"); + } + } + }; et2_date.prototype.getInputNode = function () { - return this.input_date[0]; + return this.options.inline ? _super.prototype.getInputNode.call(this) : this.input_date[0]; }; et2_date.prototype.set_type = function (_type) { if (_type != this.getType()) { diff --git a/api/js/etemplate/et2_widget_date.ts b/api/js/etemplate/et2_widget_date.ts index 2f04daaa4b..8bc2bea4ef 100644 --- a/api/js/etemplate/et2_widget_date.ts +++ b/api/js/etemplate/et2_widget_date.ts @@ -210,9 +210,33 @@ String: A string in the user\'s date format, or a relative date. Relative dates } } + /** + * Calendar popup sets the ID of the input, we can't change that like other inputWidgets can + * + * @param _value + */ + set_id(_value) + { + this.id = _value; + this.dom_id = _value && this.getInstanceManager() ? this.getInstanceManager().uniqueId+'_'+this.id : _value; + + var node = this.getDOMNode(this); + if (node) + { + if (_value != "") + { + node.setAttribute("id", this.dom_id); + } + else + { + node.removeAttribute("id"); + } + } + } + getInputNode(): HTMLElement { - return this.input_date[0]; + return this.options.inline ? super.getInputNode() : this.input_date[0]; } set_type(_type)