Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Following came in from Markus Büttner from the users list:
<h:form id="myForm">
<h:selectOneMenu id="selectMenu" value="#
valueChangeListener="#{myBean.menuValueChangedListener}">
<f:selectItem itemValue="true" itemLabel="Yes"/>
<f:selectItem itemValue="false" itemLabel="No"/>
<f:ajax event="change" render="output"/>
</h:selectOneMenu>
<h:outputText id="output" value="#{myBean.menuValue}
"/>
<h:commandButton action="action"/>
</h:form>
Switching from no to yes works, but switching from yes to no causes the
following error messages in browser (firefox) and no request is send to
server:
clientError-TypeError-MyFaces ERROR:Affected Class:
myfaces._impl.xhrCore._AjaxUtils
Affected Method: encodeSubmittableFields
Error name: TypeError
Error message: subBuf is undefined
Error description: undefined
Error number: undefined
Error line number: 3380
- Note, this message is only sent, because project stage is development
and no other error listeners are registered.
The message in IE8:
lientError-TypeError-MyFaces ERROR:Affected Class:
myfaces._impl.xhrCore._AjaxUtils
Affected Method: encodeSubmittableFields
Error name: TypeError
Error message: 'undefined' ist Null oder kein Object
Error description: 'undefined' ist Null oder kein Object
Error number: -2146823281
Error line number: undefined
- Note, this message is only sent, because project stage is development
and no other error listeners are registered.
I tried to use boolean, String an enum Types for Value. But always the
same error.
This is probably also the same bug Bruno Aranda has reported:
I think a bug was introduced in the revision 960856 last 6th of July,
in the _AjaxUtils class. A variable is initialized inside a loop, but
is accessed outside. If the loop contains no values, the variable will
be left undefined. This is the code, lines 196-207:
if (element.options[u].selected) {
var subBuf = [];
var elementOption = element.options[u];
subBuf.push(encodeURIComponent(name));
subBuf.push("=");
if (elementOption.getAttribute("value") != null)
else
{ subBuf.push(encodeURIComponent(elementOption.text)); }} strBuf.push(subBuf.join(""));
subBuf is accessed outside the loop, but initialized inside. If there
are no "options selected", subBuf will throw an 'undefined' javascript
exception. I guess that subBuf should be initialized outside the loop?