I have a backing bean which is ViewScoped
. I have some ajax enabled SelectBooleanCheckbox
es in a form.
Example:
<p:selectBooleanCheckbox value="#{formBean.value2}">
<p:ajax update=":theform"/>
</p:selectBooleanCheckbox>
Normally, some hidden input fields should be in the html to pass through the viewstate id. The problem is that those don't get initiated on the first page request. When I click one of the checkboxes, the form (and thus the checkboxes) get refreshed. From this moment the view state id is being sent with those checkboxes so the viewstate can be preserved.
The biggest problem in this is that on the first ajax call a set of new ViewScoped beans is initiated and so I lose data about the first action. From then on everything seems to work properly.
Can anyone give me any directions on what might be the problem?
The exact code:
<p:panel header="Schedule" toggleable="true">
<form>
<p:outputPanel id="schedule">
<ui:repeat var="scheduleDay" value="#{jobBean.jobScheduleDays}">
<div>
<p:selectBooleanCheckbox value="#{scheduleDay.selected}" style="margin:4px">
<p:ajax update=":schedule" />
</p:selectBooleanCheckbox>
<h:outputText value="#{scheduleDay.readableDay}" style="text-transform:capitalize"/>
</div>
</ui:repeat>
</p:outputPanel>
</form>
</p:panel>