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 9156753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:50:45+00:00 2026-06-17T12:50:45+00:00

I want a dialog to show up after I click a commandButton , but

  • 0

I want a dialog to show up after I click a commandButton, but it doesn’t show up at all.
I think the button is submitting the form instead of showing up a dialog. What’s more I’ve tried to make a 'Cancel' commandButton and it is also not working as it should – it works only if I click it first (if I click commandButton which is suppoused to open a dialog first, the cancel button won’t work anymore).

Here’s my .xhtml:

<ui:define name="content">
     <p:dialog id="dlg" header="#{messages.chooseSkillLevel}" widgetVar="dlg" modal="true" dynamic="true">
       <h:form>
         <h:dataTable value="#{editSkills.skillsAndLevels}" var="skillslevel">
            <h:column>
               #{skillslevel.skill.umiejetnosc}
            </h:column>
            <h:column>
               <p:selectOneMenu value="#{skillslevel.level}" >
                   <f:selectItems value="#{editSkills.levels}" var="level" itemLabel="#{level.stopien}" itemValue="#{level.id}" />
               </p:selectOneMenu>
            </h:column>
         </h:dataTable>
         <p:commandButton value="#{messages.confirm}" action="#{editSkills.showSkillsAndLevels}" oncomplete="dlg.hide();" />
         <p:commandButton value="#{messages.cancel}" onclick="dlg.hide()"/>
       </h:form>
     </p:dialog>
     <h:form>
        <p:messages/>
          <p:pickList value="#{editSkills.skills}" var="skill" effect="none"  converter="#{picklistConverter}"
                itemValue="#{skill.id}" itemLabel="#{skill.umiejetnosc}"  
                showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" 
                addLabel="#{messages.add}" removeLabel="#{messages.remove}" removeAllLabel="#{messages.removeAll}" >  
                <f:facet name="sourceCaption">#{messages.skillsList}</f:facet>  
                <f:facet name="targetCaption">#{messages.yourSkills}</f:facet>
                <p:ajax event="transfer" listener="#{editSkills.onTransfer}" /> 
                <p:column style="width:100%;">  
                    #{skill.umiejetnosc}  
                </p:column> 
          </p:pickList>      
          <p:commandButton value="#{messages.confirm}" actionListener="#{editSkills.afterSubmit}" update=":dlg" oncomplete="dlg.show();" />  THIS IS THE MENTIONED BUTTON  
          <p:commandButton value="#{messages.cancel}" action="profile" immediate="true"/>  THIS IS THE CANCEL BUTTON
     </h:form>
</ui:define>

What should I do to make it working well?

  • 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-17T12:50:46+00:00Added an answer on June 17, 2026 at 12:50 pm

    Your code seems fine to me :). However, 1 thing you need to note is that the id and widgetVar attributes of the <p:dialog> must not have the same value. Try something like the following:

    <p:dialog id="levelDlg" widgetVar="levelDialog">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hii I want show a pop up Dialog box when i click on to
I want to click a <select> but stop it to show his dropdown list
I want to show a confirmation dialog and if user press 'continue', the form
Is there a way to start off showing a dialog modally, but then instead
I want to show a dialog (kind of splash screen) when my application is
I want to show a dialog that will allow the user to select a
I want to show some dialog (absolute positioned div), and I want to show
I want to show a Dialog with an EditText . I envision it having
I want my Application to show Custom Dialog When an Uncatch Exception occur. For
I want to show a open dialog for the user, where the user can

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.