var isDateTime = (elAttr(element, 'type') === 'datetime');
var isTimeOnly = (isDateTime && elDataBool(element, 'time-only'));
+ var disableClear = elDataBool(element, 'disable-clear');
elData(element, 'is-date-time', isDateTime);
elData(element, 'is-time-only', isTimeOnly);
element.parentNode.insertBefore(container, element);
container.insertBefore(element, button);
- button = elCreate('a');
- button.className = 'inputSuffix button';
- button.addEventListener(WCF_CLICK_EVENT, this.clear.bind(this, element));
- if (isEmpty) button.style.setProperty('visibility', 'hidden', '');
-
- container.appendChild(button);
-
- icon = elCreate('span');
- icon.className = 'icon icon16 fa-times';
- button.appendChild(icon);
+ if (!disableClear) {
+ button = elCreate('a');
+ button.className = 'inputSuffix button';
+ button.addEventListener(WCF_CLICK_EVENT, this.clear.bind(this, element));
+ if (isEmpty) button.style.setProperty('visibility', 'hidden', '');
+
+ container.appendChild(button);
+
+ icon = elCreate('span');
+ icon.className = 'icon icon16 fa-times';
+ button.appendChild(icon);
+ }
// check if the date input has one of the following classes set otherwise default to 'short'
var hasClass = false, knownClasses = ['tiny', 'short', 'medium', 'long'];
clearButton: button,
shadow: shadowElement,
+ disableClear: disableClear,
isDateTime: isDateTime,
isEmpty: isEmpty,
isTimeOnly: isTimeOnly,
_input.value = value;
elData(_input, 'value', date.getTime());
- data.clearButton.style.removeProperty('visibility');
+ if (!data.disableClear) data.clearButton.style.removeProperty('visibility');
data.shadow.value = shadowValue;
},
element.removeAttribute('data-value');
element.value = '';
- data.clearButton.style.setProperty('visibility', 'hidden', '');
+ if (!data.disableClear) data.clearButton.style.setProperty('visibility', 'hidden', '');
data.isEmpty = true;
data.shadow.value = '';
},