Hi,
I have a problem updating a view when I submit using 'onchange' event in a selectOneMenu (or other component that write an html-select output).
When I use the onchange event to submit the view, if I have another component (B), text or jstl syntax after the select component that is submitting the view (A), that A component disappear. Not always, only when the B component is optional and is depending on any property selected in A. It disappears when you select a property (in A) that do a visible HTML layout (in B).
Here is an example:
<h:panelGrid columns="6" cellspacing="0px" cellpadding="3px">
Name:<h:inputText value="#{Bean.name}" styleClass="textfield" maxlength="25">
<f:validator validatorId="DBParamChecker"/><f:validateLength maximum="25" />
</h:inputText>
Surname:<h:inputText value="#{Bean.surname}" styleClass="textfield" maxlength="25">
<f:validator validatorId="DBParamChecker"/><f:validateLength maximum="25" />
</h:inputText>
Result Type:<h:selectOneMenu value="#{Bean.ResultType}" styleClass="textfield" onchange="submit();" immediate="true" > [u]<!-- this is the A component -->[/u]
<f:selectItems value="#{Bean.availableResultType}" />
</h:selectOneMenu>
<c:choose> [u]<!-- this is the B component -->[/u]
<c:when test="${Bean.ResultType == '1'}">
ext1
</c:when>
<c:when test="${Bean.ResultType == '2'}">
ext2
</c:when>
</c:choose>
</h:panelGrid>
When you select resulttype='3' and then resultType='2' the select component disappear if I submit using the select. But if I encapsulate the JSTL core statement 'if' inside a panelgroup, the problem disappears.
The code I use to get the layout that I want:
[b]<h:panelGroup layout="block">[/b]
<c:choose>
<c:when test="${Bean.ResultType == '1'}">
ext1
</c:when>
<c:when test="${Bean.ResultType == '2'}">
ext2
</c:when>
</c:choose>
[b] </h:panelGroup>[/b]
I don't know if that is the right way. But I think it is tedious to have to encapsulate the jstl statement to get what I want.
I have been looking for this behavior in the forum but I didn't find any message with my search string ("select event onchange"), neither in the documentation of jsf (sun's version).
Is it a bug? Am I on a mistake?
Thanks...
Comments: Sorry if I there is errors with my english.
[Message sent by forum member 'joreyes78' (joreyes78)]
http://forums.java.net/jive/thread.jspa?messageID=247535