2006-11-01 21:28:35 +01:00
|
|
|
HTMLInputElement.prototype._replicate = function() {
|
|
|
|
if (this.replica) {
|
|
|
|
this.replica.value = this.value;
|
2007-05-09 23:27:55 +02:00
|
|
|
var onReplicaChangeEvent = document.createEvent("UIEvents");
|
2006-11-01 21:28:35 +01:00
|
|
|
onReplicaChangeEvent.initEvent("change", true, true);
|
|
|
|
this.replica.dispatchEvent(onReplicaChangeEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLInputElement.prototype.assignReplica = function(otherInput) {
|
|
|
|
if (!this._onChangeBound) {
|
|
|
|
this.addEventListener("change", this._replicate, false);
|
|
|
|
this._onChangeBound = true;
|
|
|
|
}
|
|
|
|
this.replica = otherInput;
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLInputElement.prototype.valueAsDate = function () {
|
2006-11-07 17:13:03 +01:00
|
|
|
return this.value.asDate();
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLInputElement.prototype.setValueAsDate = function(dateValue) {
|
|
|
|
if (!this.dateSeparator)
|
|
|
|
this._detectDateSeparator();
|
|
|
|
this.value = dateValue.stringWithSeparator(this.dateSeparator);
|
|
|
|
}
|
2006-11-01 21:28:35 +01:00
|
|
|
|
2006-11-07 17:13:03 +01:00
|
|
|
HTMLInputElement.prototype.updateShadowValue = function () {
|
|
|
|
this.setAttribute("shadow-value", this.value);
|
2006-11-01 21:28:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HTMLInputElement.prototype._detectDateSeparator = function() {
|
|
|
|
var date = this.value.split("/");
|
|
|
|
if (date.length == 3)
|
|
|
|
this.dateSeparator = "/";
|
|
|
|
else
|
|
|
|
this.dateSeparator = "-";
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLInputElement.prototype.valueAsShortDateString = function() {
|
|
|
|
var dateStr = '';
|
|
|
|
|
|
|
|
if (!this.dateSeparator)
|
|
|
|
this._detectDateSeparator();
|
|
|
|
|
|
|
|
var date = this.value.split(this.dateSeparator);
|
|
|
|
if (this.dateSeparator == '/')
|
|
|
|
dateStr += date[2] + date[1] + date[0];
|
|
|
|
else
|
|
|
|
dateStr += date[0] + date[1] + date[2];
|
|
|
|
|
|
|
|
return dateStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* "select" is part of the inputs so it's included here */
|
|
|
|
HTMLSelectElement.prototype._replicate = function() {
|
|
|
|
if (this.replica) {
|
|
|
|
this.replica.value = this.value;
|
2007-05-09 23:27:55 +02:00
|
|
|
var onReplicaChangeEvent = document.createEvent("UIEvents");
|
2006-11-01 21:28:35 +01:00
|
|
|
onReplicaChangeEvent.initEvent("change", true, true);
|
|
|
|
this.replica.dispatchEvent(onReplicaChangeEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLSelectElement.prototype.assignReplica = function(otherSelect) {
|
|
|
|
if (!this._onChangeBound) {
|
|
|
|
this.addEventListener("change", this._replicate, false);
|
|
|
|
this._onChangeBound = true;
|
|
|
|
}
|
|
|
|
this.replica = otherSelect;
|
|
|
|
}
|
2006-11-07 17:13:03 +01:00
|
|
|
|
|
|
|
HTMLSelectElement.prototype.updateShadowValue = function () {
|
|
|
|
this.setAttribute("shadow-value", this.value);
|
|
|
|
}
|