Hi,
I am generating a custom panelTabbedPane and panel tabs from the setter
of my bean. I am including the code below. Everything looks fine when
the page first shows up, and the values are all correctly checked (in
the case of SelectOneBooleanCheckbox) or set (in the case of
SelectMany). The html options for the selects are rendered correctly
with the value/label pairs.
The problem happens when I submit. It is as if all the inputs are
cleared of values and then set to the bound bean field. For example,
all checkbox value holders are set to false, and the ids in the case of
selectMany are set to null. Here are the code snippets:
Bean:
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
HtmlPanelTab hpt = (HtmlPanelTab)
app.createComponent(HtmlPanelTab.COMPONENT_TYPE);
hpt.setLabel(label);
List<UIComponent> tabChildren = hpt.getChildren();
HtmlDataTable hdt = (HtmlDataTable)
app.createComponent(HtmlDataTable.COMPONENT_TYPE);
hdt.setId("table_" + label);
tabChildren.add(hdt);
hdt.setStyleClass("table-background");
hdt.setHeaderClass("table-header");
hdt.setRowClasses("row-odd,row-even");
hdt.setVar("item");
hdt.setValue(values);
HtmlSimpleColumn hsc = null;
hsc = ComponentUtils.createDataTableColumn(hdt, "participates");
ComponentUtils.createUIComponent(context,
HtmlSelectBooleanCheckbox.COMPONENT_TYPE, "#{item.participates}", hsc);
hsc = ComponentUtils.createDataTableColumn(hdt, "comment");
HtmlSelectOneMenu hsom = (HtmlSelectOneMenu) ComponentUtils
.createUIComponent(context,
HtmlSelectOneMenu.COMPONENT_TYPE, "#{item.comment.id}", hsc);
ComponentUtils.createUIComponent(context,
UISelectItems.COMPONENT_TYPE, "#{Bean.comments.selectList}", hsom);
jsf:
<h:form styleClass="crudForm">
<h:commandButton styleClass="crudButton"
value="#{bundle.save_changes}"
action="#{Bean.saveChanges}"/>
<t:panelTabbedPane activeTabStyleClass="active_tab"
inactiveTabStyleClass="inactive_tab"
binding="#{Bean.tabs}">
</t:panelTabbedPane>
</h:form>
Here is a piece of my log before and after the submit for the same record:
{Id: 1 Num: 222222 Name: Test Guy,true} {1:None}
this is participates-------------^ ^---- this is
comment.id
after submit (even though participates is still checked):
{Id: 1 Num: 222222 Name: Test Guy,false} {null:None}
Does anyone have any clue?
Thanks,
--
Don Tam
Manager, Software Development
(416)493-6111x143
[EMAIL PROTECTED]