0

I am using Mojarra 2.2.0 from Glassfish 4.0.

I have a search-form and I want to execute an action after selecting a checkbox, but the action is only executed on the second click.

<h:selectManyCheckbox
    value="#{searchBean.facetSelectionChoosen}"
    layout="pageDirection"
    styleClass="checkbox"
    >
<f:selectItems value="#{searchBean.facetSelectionAvailable}"/>

<f:ajax execute="@form" listener="#{searchBean.search}" render="@form" />
</h:selectManyCheckbox>

On the first select of one checkbox the browser sends a POST-Request to the server and retrieves the matching HTML fragment, but the action is not executed.


This is the request body:

searchForm=searchForm&searchForm%3Aj_idt14=INF.27.X&searchForm%3Aj_idt17=&searchForm%3Aj_idt21=&searchForm%3Aj_idt23=&searchForm%3Aj_idt25=&searchForm%3Aj_idt27=&searchForm%3Aj_idt29=&searchForm%3Aj_idt31=&searchForm%3Aj_idt33=&searchForm%3Aj_idt35=&searchForm%3Aj_idt40=&searchForm%3Aj_idt42=&searchForm%3Aj_idt44=&javax.faces.source=searchForm%3Aj_idt14%3A0&javax.faces.partial.event=click&javax.faces.partial.execute=searchForm%3Aj_idt14%20searchForm&javax.faces.partial.render=searchForm&javax.faces.behavior.event=valueChange&javax.faces.partial.ajax=true

If I do another select of a checkbox the action is executed. This is the request body of the second request:

searchForm=searchForm&searchForm%3Aj_idt14=INF.27.X&searchForm%3Aj_idt17=&searchForm%3Aj_idt21=&searchForm%3Aj_idt23=&searchForm%3Aj_idt25=&searchForm%3Aj_idt27=&searchForm%3Aj_idt29=&searchForm%3Aj_idt31=&searchForm%3Aj_idt33=&searchForm%3Aj_idt35=&searchForm%3Aj_idt40=&searchForm%3Aj_idt42=&searchForm%3Aj_idt44=&javax.faces.ViewState=-2850678035461429390%3A7352800471989777110&javax.faces.source=searchForm%3Aj_idt14%3A0&javax.faces.partial.event=click&javax.faces.partial.execute=searchForm%3Aj_idt14%20searchForm&javax.faces.partial.render=searchForm&javax.faces.behavior.event=valueChange&javax.faces.partial.ajax=true

The only difference I can recognize is that the second request contains the following parameter:

&javax.faces.ViewState=-2850678035461429390%3A7352800471989777110

Does anyone of you know what the problem is or what I have to do to fix that?

Veedrac
  • 58,273
  • 15
  • 112
  • 169
user3347451
  • 39
  • 1
  • 6

0 Answers0