tags:

views:

35

answers:

1

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 the 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?

A: 

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>
pakore