Well, this bugs also happens when keeplayout is true.
The following patch seems to works against the 0.5.2
uncompressed one-file-distribution.
It just avoids to use the HTMLSelectListModel hack, allowing
a null model on SelectFormInput wich makes
SelectFormInput.render() a no-op under this condition:
Anyway, this should be applied to the original sources and
be included on a 0.5.3 bugfix release, wich should also fix
the bug described above.
/***
@@ -3505,10 +3507,12 @@
Renders the options according to the
:mochiref:`UI.ListModel` assigned.
***/
'render': function() {
- replaceChildNodes(this.element, []);//For now we
just erase the old options
- for (var i = 0; i < this._model.getLength(); i++) {
- this.element.appendChild(OPTION({'value':
this._model.getValue(i)},
-
this._model.getLabel(i)));
+ if (this._model) {
+ replaceChildNodes(this.element, []);//For now we
just erase the old options
+ for (var i = 0; i < this._model.getLength(); i++) {
+ this.element.appendChild(OPTION({'value':
this._model.getValue(i)},
+
this._model.getLabel(i)));
+ }
}
}
});
@@ -3699,10 +3703,9 @@
model = eval("(" + model + ")");
return new UI.SelectFormInput(el,
UI.FormInput._getValidators(el), model);
} else {
- model = new UI.HTMLSelectListModel(el.cloneNode(true));
+ model = null;
var select = new UI.SelectFormInput(el,
UI.FormInput._getValidators(el), model);
//map(removeElement, select.childNodes);
- select.render();
return select;
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=1175721
This happens only on auto-layout mode (when the form
ui:keeplayout attribute is not "true")
Looking at the HTML rendered on the Simple form demo, this
is what is shown:
<select class="uiselectforminput" ui:label="Country"
name="country" id="country"><table
class="noborderspace"><tbody><tr class="noborderspace"><td
class="noborderspace"><option
value="CL">Chile</option></td><td
class="noborderspace"><option
value="ES">Spain</option></td><td
class="noborderspace"><option value="US">United
States</option></td></tr></tbody></table></select>
This explain the weird options positioning on FFox and the
absence of them on IE.
Logged In: YES
user_id=1175721
Well, this bugs also happens when keeplayout is true.
The following patch seems to works against the 0.5.2
uncompressed one-file-distribution.
It just avoids to use the HTMLSelectListModel hack, allowing
a null model on SelectFormInput wich makes
SelectFormInput.render() a no-op under this condition:
Anyway, this should be applied to the original sources and
be included on a 0.5.3 bugfix release, wich should also fix
the bug described above.
--- ui.js 9 Aug 2006 16:01:31 -0000 1.1
+++ ui.js 9 Aug 2006 19:19:55 -0000
@@ -3472,7 +3472,9 @@
this.element = $(element);
this.cssClass = "uiselectforminput";
this.register();
- this.setModel(model);
+ if (model) {
+ this.setModel(model);
+ }
}
/***
@@ -3505,10 +3507,12 @@
Renders the options according to the
:mochiref:`UI.ListModel` assigned.
***/
'render': function() {
- replaceChildNodes(this.element, []);//For now we
just erase the old options
- for (var i = 0; i < this._model.getLength(); i++) {
- this.element.appendChild(OPTION({'value':
this._model.getValue(i)},
-
this._model.getLabel(i)));
+ if (this._model) {
+ replaceChildNodes(this.element, []);//For now we
just erase the old options
+ for (var i = 0; i < this._model.getLength(); i++) {
+ this.element.appendChild(OPTION({'value':
this._model.getValue(i)},
+
this._model.getLabel(i)));
+ }
}
}
});
@@ -3699,10 +3703,9 @@
model = eval("(" + model + ")");
return new UI.SelectFormInput(el,
UI.FormInput._getValidators(el), model);
} else {
- model = new UI.HTMLSelectListModel(el.cloneNode(true));
+ model = null;
var select = new UI.SelectFormInput(el,
UI.FormInput._getValidators(el), model);
//map(removeElement, select.childNodes);
- select.render();
return select;
}
}