Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7998715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:17:22+00:00 2026-06-04T15:17:22+00:00

I have a table of users with an a4j:commandLink which deletes the corresponding user,

  • 0

I have a table of users with an a4j:commandLink 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:

            <h:form id="formUsuariosRegistrados">
                <rich:dataScroller for="usersTable" fastControls="hide"
                                   boundaryControls="hide" />
                <rich:dataTable id="usersTable" rows="10" var="user"
                                value="#{administrationBean.tablaUsuarios}">
                    <f:facet name="header">
                        <rich:columnGroup>
                            <rich:column>
                                <h:outputText value="Nombre"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Usuario"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Dependencia"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Email"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Tipo usuario"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Tipo dependencia"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Fecha límite"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value=""/>
                            </rich:column>
                        </rich:columnGroup>
                    </f:facet>
                    <rich:column>
                        <h:outputText value="#{user.nombre}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.usuario}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.dependencia}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.correo}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.tipoUsuario}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.tipoDependencia}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.fechaLimiteCarga}"/>
                    </rich:column>
                    <rich:column>
                        <a4j:commandLink value="Eliminar" immediate="true"
                                         execute="@form"
                                         onclick="return confirm('Esta seguro(a) que deseea continuar?')"
                                         render="@form :formFechaLimite :formModificarContrasena"
                                         action="#{administrationBean.doEliminarUsuario(user.usuario)}"/>
                    </rich:column>
                </rich:dataTable>
            </h:form>

UPDATE

Here’s another piece of code that I added to the same view, but now happen two things:

  1. When View is first loaded, if I click on the a4j:commandLink on the table, the action gets called fine.

  2. After doing 1, when I try to check (or uncheck) the <h:sekectBooleanCheckBox> now this component executes ajax after clicking twice.

  3. I tried what BalusC’s answers says but I think I am not doing it right with this new form.

    Please advise, cheers

        <h:form id="formFechaLimite">
            <rich:panel style="width: 400px" id="panelFechaLimite">
                <f:facet name="header">
                    <h:outputText value="Fecha limite de carga"/>
                </f:facet>
    
                <h:outputLabel for="fechaLimite" value="Fecha Limite"/>
                <br/>
                <rich:calendar id="fechaLimite"
                               value="#{administrationBean.fechaLimite}"
                               datePattern="dd/MM/yyyy">
                    <a4j:ajax event="change" render="usuarios fechaLimiteModificada"
                              listener="#{administrationBean.doHideEtiquetaFechaModificada}"/>
                </rich:calendar>
                <br/>
                <h:outputLabel for="todosUsuarios"
                               value="Aplicar a todos los usuarios? "/>
                <h:selectBooleanCheckbox id="todosUsuarios"
                                         value="#{administrationBean.fechaTodosUsuarios}">
                    <a4j:ajax event="change" render="usuarios fechaLimiteModificada"
                              listener="#{administrationBean.doCheckBoxChanged}"/>
                </h:selectBooleanCheckbox>
                <br/>
                <a4j:outputPanel id="usuarios">
                    <rich:select value="#{administrationBean.selectedUser}"
                                 defaultLabel="Seleccione un usuario..."
                                 rendered="#{not administrationBean.fechaTodosUsuarios}">
                        <f:selectItems value="#{administrationBean.selectUser}"/>
                        <a4j:ajax event="selectitem" render="fechaLimiteModificada"
                                  listener="#{administrationBean.doHideEtiquetaFechaModificada}"/>
                    </rich:select>
                </a4j:outputPanel>
                <br/><br/>
                <a4j:commandButton value=" Aplicar " execute="@form"
                                   render="@form :panelUsuarios :formUsuariosRegistrados :usersTable"
                                   action="#{administrationBean.doCambiarFechaLimite}"/>
                <a4j:outputPanel id="fechaLimiteModificada">
                    <h:outputText value="Fecha límite modificada !"
                                  rendered="#{administrationBean.renderedEtiquetaFechaModicada}"
                                  style="color: #D17100; font-size: 14px;"/>
                </a4j:outputPanel>
            </rich:panel>
            <br/>
        </h:form>
    
        <br/>
    
        <rich:panel style="width: 800px" id="panelUsuarios">
            <f:facet name="header">
                <h:outputText value="Administración de usuarios"/>
            </f:facet>
            <h:form id="formUsuariosRegistrados">
                <rich:dataScroller for="usersTable" fastControls="hide"
                                   boundaryControls="hide" />
                <rich:dataTable id="usersTable" rows="10" var="user"
                                value="#{administrationBean.tablaUsuarios}">
                    <f:facet name="header">
                        <rich:columnGroup>
                            <rich:column>
                                <h:outputText value="Nombre"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Usuario"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Dependencia"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Email"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Tipo usuario"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Tipo dependencia"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Fecha límite"/>
                            </rich:column>
                            <rich:column>
                                <h:outputText value=""/>
                            </rich:column>
                        </rich:columnGroup>
                    </f:facet>
                    <rich:column>
                        <h:outputText value="#{user.nombre}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.usuario}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.dependencia}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.correo}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.tipoUsuario}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.tipoDependencia}"/>
                    </rich:column>
                    <rich:column>
                        <h:outputText value="#{user.fechaLimiteCarga}"/>
                    </rich:column>
                    <rich:column>
                        <a4j:commandLink value="Eliminar" immediate="true"
                                         execute="@form"
                                         ondblclick="return confirm('Esta seguro(a) que deseea continuar?')"
                                         render="@form :formFechaLimite :formModificarContrasena"
                                         action="#{administrationBean.doEliminarUsuario(user.usuario)}"/>
                    </rich:column>
                </rich:dataTable>
            </h:form>
    
            <br/>
    
        </rich:panel>
    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:17:24+00:00Added an answer on June 4, 2026 at 3:17 pm

    In the other form wherein you’re updating the shown form with the table, make sure that you include the client ID of the form in the ajax render. Otherwise the updated form will lose its view state and thus nothing will be processed on 1st submit. After the 1st submit the form get its view state back and subsequent submits will be processed successfully.

    E.g.

    <h:form>
      ...
        <h:commandButton value="Submit" action="#{bean.submit}">
            <f:ajax execute="@form" render=":otherPanel :otherForm" />
        </h:commandButton>
    </h:form>
    
    <h:panelGroup id="otherPanel">
        ...
        <h:form id="otherForm">
            ...
        </h:form>
        ...
    </h:panelGroup>
    

    This problem is related to JSF spec issue 790 and is fixed for the upcoming JSF 2.2. PrimeFaces 3.x doesn’t have this problem as its modified JSF ajax engine has already taken this into account.

    See also:

    • Communication in JSF2 – Ajax rendering of content which contains another form
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user table 'users' that has fields like: id first_name last_name ...
I have a table users which has a primary key userid and a datetime
I have a table users with primary index userId . Currently, each user has
I have a table called Users ( class User < ActiveRecord::Base ) and a
I have a table called USERS that has a foreign key to the table
In my JPA2/Hibernate application I have table USERS and matching entity User + DAO.
I have table Users which contains columns Login and Phone and I have table
I have table Users which contains columns: id, name, points, extra_points. How can I
for example i have table users , which have 3 fields: id - login
So I have a table of user accounts (Users). There needs to be functionality

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.