title: a4j:commandLink executes action after double clicking
body: <p>I have a table of users with an <code>a4j:commandLink</code> which deletes the corresponding user, but the problem is that I need to click twice for the action to execute, how can I solve it, here's the code:</p>
  <pre><code>            &lt;h:form id=&quot;formUsuariosRegistrados&quot;&gt;
                  &lt;rich:dataScroller for=&quot;usersTable&quot; fastControls=&quot;hide&quot;
                                     boundaryControls=&quot;hide&quot; /&gt;
                  &lt;rich:dataTable id=&quot;usersTable&quot; rows=&quot;10&quot; var=&quot;user&quot;
                                  value=&quot;#{administrationBean.tablaUsuarios}&quot;&gt;
                      &lt;f:facet name=&quot;header&quot;&gt;
                          &lt;rich:columnGroup&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;Nombre&quot;/&gt;
                              &lt;/rich:column&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;Usuario&quot;/&gt;
                              &lt;/rich:column&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;Dependencia&quot;/&gt;
                              &lt;/rich:column&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;Email&quot;/&gt;
                              &lt;/rich:column&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;Tipo usuario&quot;/&gt;
                              &lt;/rich:column&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;Tipo dependencia&quot;/&gt;
                              &lt;/rich:column&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;Fecha límite&quot;/&gt;
                              &lt;/rich:column&gt;
                              &lt;rich:column&gt;
                                  &lt;h:outputText value=&quot;&quot;/&gt;
                              &lt;/rich:column&gt;
                          &lt;/rich:columnGroup&gt;
                      &lt;/f:facet&gt;
                      &lt;rich:column&gt;
                          &lt;h:outputText value=&quot;#{user.nombre}&quot;/&gt;
                      &lt;/rich:column&gt;
                      &lt;rich:column&gt;
                          &lt;h:outputText value=&quot;#{user.usuario}&quot;/&gt;
                      &lt;/rich:column&gt;
                      &lt;rich:column&gt;
                          &lt;h:outputText value=&quot;#{user.dependencia}&quot;/&gt;
                      &lt;/rich:column&gt;
                      &lt;rich:column&gt;
                          &lt;h:outputText value=&quot;#{user.correo}&quot;/&gt;
                      &lt;/rich:column&gt;
                      &lt;rich:column&gt;
                          &lt;h:outputText value=&quot;#{user.tipoUsuario}&quot;/&gt;
                      &lt;/rich:column&gt;
                      &lt;rich:column&gt;
                          &lt;h:outputText value=&quot;#{user.tipoDependencia}&quot;/&gt;
                      &lt;/rich:column&gt;
                      &lt;rich:column&gt;
                          &lt;h:outputText value=&quot;#{user.fechaLimiteCarga}&quot;/&gt;
                      &lt;/rich:column&gt;
                      &lt;rich:column&gt;
                          &lt;a4j:commandLink value=&quot;Eliminar&quot; immediate=&quot;true&quot;
                                           execute=&quot;@form&quot;
                                           onclick=&quot;return confirm('Esta seguro(a) que deseea continuar?')&quot;
                                           render=&quot;@form :formFechaLimite :formModificarContrasena&quot;
                                           action=&quot;#{administrationBean.doEliminarUsuario(user.usuario)}&quot;/&gt;
                      &lt;/rich:column&gt;
                  &lt;/rich:dataTable&gt;
              &lt;/h:form&gt;
  </code></pre>
  <p><strong>UPDATE</strong></p>
  <p>Here's another piece of code that I added to the same view, but now happen two things:</p>
  <ol>
  <li><p>When View is first loaded, if I click on the <code>a4j:commandLink</code> on the table, the action gets called fine.</p>
  </li>
  <li><p>After doing 1, when I try to check (or uncheck) the <code>&lt;h:sekectBooleanCheckBox&gt;</code> now this component executes ajax after clicking twice.</p>
  </li>
  <li><p>I tried what BalusC's answers says but I think I am not doing it right with this new form.</p>
  <p>Please advise, cheers</p>
  <pre><code>    &lt;h:form id=&quot;formFechaLimite&quot;&gt;
          &lt;rich:panel style=&quot;width: 400px&quot; id=&quot;panelFechaLimite&quot;&gt;
              &lt;f:facet name=&quot;header&quot;&gt;
                  &lt;h:outputText value=&quot;Fecha limite de carga&quot;/&gt;
              &lt;/f:facet&gt;
  
              &lt;h:outputLabel for=&quot;fechaLimite&quot; value=&quot;Fecha Limite&quot;/&gt;
              &lt;br/&gt;
              &lt;rich:calendar id=&quot;fechaLimite&quot;
                             value=&quot;#{administrationBean.fechaLimite}&quot;
                             datePattern=&quot;dd/MM/yyyy&quot;&gt;
                  &lt;a4j:ajax event=&quot;change&quot; render=&quot;usuarios fechaLimiteModificada&quot;
                            listener=&quot;#{administrationBean.doHideEtiquetaFechaModificada}&quot;/&gt;
              &lt;/rich:calendar&gt;
              &lt;br/&gt;
              &lt;h:outputLabel for=&quot;todosUsuarios&quot;
                             value=&quot;Aplicar a todos los usuarios? &quot;/&gt;
              &lt;h:selectBooleanCheckbox id=&quot;todosUsuarios&quot;
                                       value=&quot;#{administrationBean.fechaTodosUsuarios}&quot;&gt;
                  &lt;a4j:ajax event=&quot;change&quot; render=&quot;usuarios fechaLimiteModificada&quot;
                            listener=&quot;#{administrationBean.doCheckBoxChanged}&quot;/&gt;
              &lt;/h:selectBooleanCheckbox&gt;
              &lt;br/&gt;
              &lt;a4j:outputPanel id=&quot;usuarios&quot;&gt;
                  &lt;rich:select value=&quot;#{administrationBean.selectedUser}&quot;
                               defaultLabel=&quot;Seleccione un usuario...&quot;
                               rendered=&quot;#{not administrationBean.fechaTodosUsuarios}&quot;&gt;
                      &lt;f:selectItems value=&quot;#{administrationBean.selectUser}&quot;/&gt;
                      &lt;a4j:ajax event=&quot;selectitem&quot; render=&quot;fechaLimiteModificada&quot;
                                listener=&quot;#{administrationBean.doHideEtiquetaFechaModificada}&quot;/&gt;
                  &lt;/rich:select&gt;
              &lt;/a4j:outputPanel&gt;
              &lt;br/&gt;&lt;br/&gt;
              &lt;a4j:commandButton value=&quot; Aplicar &quot; execute=&quot;@form&quot;
                                 render=&quot;@form :panelUsuarios :formUsuariosRegistrados :usersTable&quot;
                                 action=&quot;#{administrationBean.doCambiarFechaLimite}&quot;/&gt;
              &lt;a4j:outputPanel id=&quot;fechaLimiteModificada&quot;&gt;
                  &lt;h:outputText value=&quot;Fecha límite modificada !&quot;
                                rendered=&quot;#{administrationBean.renderedEtiquetaFechaModicada}&quot;
                                style=&quot;color: #D17100; font-size: 14px;&quot;/&gt;
              &lt;/a4j:outputPanel&gt;
          &lt;/rich:panel&gt;
          &lt;br/&gt;
      &lt;/h:form&gt;
  
      &lt;br/&gt;
  
      &lt;rich:panel style=&quot;width: 800px&quot; id=&quot;panelUsuarios&quot;&gt;
          &lt;f:facet name=&quot;header&quot;&gt;
              &lt;h:outputText value=&quot;Administración de usuarios&quot;/&gt;
          &lt;/f:facet&gt;
          &lt;h:form id=&quot;formUsuariosRegistrados&quot;&gt;
              &lt;rich:dataScroller for=&quot;usersTable&quot; fastControls=&quot;hide&quot;
                                 boundaryControls=&quot;hide&quot; /&gt;
              &lt;rich:dataTable id=&quot;usersTable&quot; rows=&quot;10&quot; var=&quot;user&quot;
                              value=&quot;#{administrationBean.tablaUsuarios}&quot;&gt;
                  &lt;f:facet name=&quot;header&quot;&gt;
                      &lt;rich:columnGroup&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;Nombre&quot;/&gt;
                          &lt;/rich:column&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;Usuario&quot;/&gt;
                          &lt;/rich:column&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;Dependencia&quot;/&gt;
                          &lt;/rich:column&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;Email&quot;/&gt;
                          &lt;/rich:column&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;Tipo usuario&quot;/&gt;
                          &lt;/rich:column&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;Tipo dependencia&quot;/&gt;
                          &lt;/rich:column&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;Fecha límite&quot;/&gt;
                          &lt;/rich:column&gt;
                          &lt;rich:column&gt;
                              &lt;h:outputText value=&quot;&quot;/&gt;
                          &lt;/rich:column&gt;
                      &lt;/rich:columnGroup&gt;
                  &lt;/f:facet&gt;
                  &lt;rich:column&gt;
                      &lt;h:outputText value=&quot;#{user.nombre}&quot;/&gt;
                  &lt;/rich:column&gt;
                  &lt;rich:column&gt;
                      &lt;h:outputText value=&quot;#{user.usuario}&quot;/&gt;
                  &lt;/rich:column&gt;
                  &lt;rich:column&gt;
                      &lt;h:outputText value=&quot;#{user.dependencia}&quot;/&gt;
                  &lt;/rich:column&gt;
                  &lt;rich:column&gt;
                      &lt;h:outputText value=&quot;#{user.correo}&quot;/&gt;
                  &lt;/rich:column&gt;
                  &lt;rich:column&gt;
                      &lt;h:outputText value=&quot;#{user.tipoUsuario}&quot;/&gt;
                  &lt;/rich:column&gt;
                  &lt;rich:column&gt;
                      &lt;h:outputText value=&quot;#{user.tipoDependencia}&quot;/&gt;
                  &lt;/rich:column&gt;
                  &lt;rich:column&gt;
                      &lt;h:outputText value=&quot;#{user.fechaLimiteCarga}&quot;/&gt;
                  &lt;/rich:column&gt;
                  &lt;rich:column&gt;
                      &lt;a4j:commandLink value=&quot;Eliminar&quot; immediate=&quot;true&quot;
                                       execute=&quot;@form&quot;
                                       ondblclick=&quot;return confirm('Esta seguro(a) que deseea continuar?')&quot;
                                       render=&quot;@form :formFechaLimite :formModificarContrasena&quot;
                                       action=&quot;#{administrationBean.doEliminarUsuario(user.usuario)}&quot;/&gt;
                  &lt;/rich:column&gt;
              &lt;/rich:dataTable&gt;
          &lt;/h:form&gt;
  
          &lt;br/&gt;
  
      &lt;/rich:panel&gt;
  </code></pre>
  </li>
  </ol>