a4j:commandButton
not calling my action in first time but after the first click it works perfectly.
This problem happened to me every reloading of the page.
Below is some part of my code
<form id="NClient">
<table>
<tr>
<td><rich:panel id="panelClient">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="#{i18n.LABEL_NOUV_CLIENT}"></h:outputText>
</h:panelGroup>
</f:facet>
<div>
<table>
<a4j:outputPanel ajaxRendered="true">
<b><h:messages
id="msgs"
style="color: red;font-size: 12px;font-style: oblique;font-style: italic;" /></b>
</a4j:outputPanel>
<tr>
<td><b><h:outputText value="Raison Sociale* : " /></b></td>
<td><h:inputText
id="rs"
required="true"
requiredMessage="Veuillez remplir le champ requis Raison sociale"
value="#{ClientBean.currentClt.rs}" /></td>
</tr>
<tr>
<td><b><h:outputText value="email* : " /></b></td>
<td><h:inputText
id="email"
required="true"
requiredMessage="Veuillez remplir le champ requis Email"
value="#{ClientBean.currentClt.email}" /></td>
</tr>
<tr>
<td><b><h:outputText value="Adresse* : " /></b></td>
<td><h:inputTextarea
value="#{ClientBean.currentClt.adresse}"
id="adresse"
required="true"
requiredMessage="Veuillez remplir le champ requis adresse " /></td>
</tr>
<tr>
<td><b><h:outputText value="Ville* : " /></b></td>
<td><h:inputText
value="#{ClientBean.currentClt.ville}"
id="ville"
required="true"
requiredMessage="Veuillez remplir le champ requis ville " /></td>
</tr>
<tr>
<td><b><h:outputText value="phone* : " /></b></td>
<td><h:inputText
value="#{ClientBean.currentClt.phone}"
id="phone"
required="true"
requiredMessage="Veuillez remplir le champ requis phone " /></td>
</tr>
</table>
</div>
</rich:panel></td>
</tr>
<tr>
<td><rich:panel id="panelAbonnement">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Abonnement"></h:outputText>
</h:panelGroup>
</f:facet>
<div>
<table>
<tr>
<td><b><h:outputText value="Date Debut* : " /></b></td>
<td><rich:calendar
id="dateDebut"
required="true"
datePattern="dd/MM/yyyy HH:mm:ss"
requiredMessage="Veuillez remplir le champ requis Date Debut"
value="#{ClientBean.dateDebut}" /></td>
</tr>
<tr>
<td><b><h:outputText value="Date Fin* : " /></b></td>
<td><rich:calendar
id="dateFin"
required="true"
datePattern="dd/MM/yyyy HH:mm:ss"
requiredMessage="Veuillez remplir le champ requis Date Fin"
value="#{ClientBean.dateFin}" /></td>
</tr>
</table>
</div>
</rich:panel></td>
</tr>
<tr>
<td><a4j:commandButton
onclick="#{rich:component('waitFormPanel')}.show()"
oncomplete="#{rich:component('waitFormPanel')}.hide()"
action="#{ClientBean.ajouterClient}"
styleClass="ajoutBtn"
value="ajouter"
limitRender="true"
render="msgs,panelClient" /></td>
</tr>
</table>
</form>
Knowing that my backing bean is sessionScoped.
For start replace the form
with h:form