开发者

Code picks up value from selectOneMenu and selectBooleanCheckbox, even though it is not rendered

I've got code the following code in my .xhtml

<t:panelGroup rendered="false">
  <t:selectOneMenu id="id" value="#{row.someValue}" displayValueOnly="#{form.readState}">
        <f:selectItems value="#{row.listOfValues}"/>
  </t:selectOneMenu>
</t:panelGroup>

The listOfValues is set in a form populator, and is thus present in the form object. Also, as expected, the portion outlined above is not rendered in the output HTML.

But, when clicking the save button in the page 开发者_StackOverflowthe following code tries to get the value from the XHTML, even though it is not rendered. It will thus not copy the value present in the form, but set it to null (as it is not set in the XHTML).

object1.setSomeValue(form.getSomeValue());

As far as I can see this only happens with selectBooleanCheckbox and selectOneMenu. E.g. inputText works fine.

Any idea on how to fix it?


Try this:

<t:panelGroup>
<t:selectOneMenu id="id" value="#{row.someValue}" displayValueOnly="#{form.readState}">
        <f:selectItems value="#{row.listOfValues}" rendered="false"/>
  </t:selectOneMenu>
</t:panelGroup>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜