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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:58:06+00:00 2026-06-12T06:58:06+00:00

I have some problem with the primefaces dialog. I have a context menu. When

  • 0

I have some problem with the primefaces dialog. I have a context menu. When I click on the context menu, it shows a dialog. This dialog contains a panel with a required input text. When the dialog is shown, a validation error is displayed in the panel because the input text is empty. The idea is to display validation error only when the user clicks on the commandButton of the dialog. Then, when the dialog is opened, it must be emptied. That means, no validation error and nothing in the input text. It seems that the attribute update in the context menu is a problem. In one side, it is necessary to empty the input text when the user displays the dialog for the second time, but it displays also the validation error the first time the dialog is displayed.

<p:contextMenu for="folderTree">  
    <p:menuitem value="New Folder" update="addFolderPanel" oncomplete="addFolderDialog.show()" actionListener="#{folderManagedBean.initDialog}" icon="ui-icon-plus"/>
</p:contextMenu> 


<p:dialog header="New Folder" widgetVar="addFolderDialog" modal="true" resizable="false"  
                      showEffect="clip" hideEffect="fold">  
    <p:outputPanel id="addFolderPanel">  
        <p:message id="defaultMessage" for="txAddFolder"/>  
        <h:panelGrid columns="2" cellpadding="4">  
             <h:outputText for="txAddFolder" value="Folder Name: *" />  
             <p:inputText id="txAddFolder" value="#{folderManagedBean.newFolderName}" required="true" requiredMessage="The field folder name is required."/> 
             <p:commandButton icon="ui-icon-check" value="OK" update="folderTree" oncomplete="handleDialogClose(xhr, status, args)" actionListener="#{folderManagedBean.addFolder}"/>
        </h:panelGrid>  
    </p:outputPanel>
</p:dialog> 

Code of the managed bean:

public void initDialog() {
    this.newFolderName = "";
    RequestContext.getCurrentInstance().reset("form:addFolderPanel");  
}

Basically, I would like to know why the dialog shows a validation error the first time it is opened and how to solve this problem.

Any help would be really appreciated.

  • 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-12T06:58:07+00:00Added an answer on June 12, 2026 at 6:58 am

    Finaly, I find myself tha answer to my question.

    It is necessary to remove the update attribute from the context menu and to add it in the attribute updateof the commandButton.
    Like that, when the user opens the dialog, there is no update, thus no validation error. Then, when he clicks on the button to save its changes there is 2 cases:

    1. The input text is correctly filled and the dialog closes normally
    2. The input text is empty. The dialog keeps open and the validation error is displayed.

    I hope it can help!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem. Dialog.dismiss() does not work. I want to input ip, username,
I have some problem with this code, when I click the start button everything
I have some problem with this mongoid. It's my first time to use mongoDB,
I have some problem. Consider this data schema in DB (for simplicity I omit
I have problem uploading with primefaces upload widget. After some investigation I noticed that
i have some problem. when i run this project, only messagebox button ok appear,
I have some problem in matlab since I was new in this programming language.
i have some problem, i just getting null value from jDateChooser in jCalendar. This
I have some problem with this jQuery code. I'm new at this but it
I have some problem with my project: def get_timein(self, cr, uid, ids, context={}): obj

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.