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

  • Home
  • SEARCH
  • 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 8958163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:08:56+00:00 2026-06-15T15:08:56+00:00

I have a component that I want to show/hide after user hits a commandButton

  • 0

I have a component that I want to show/hide after user hits a commandButton.

It’s like this:

<h:commandButton id="showButton" value="#{bean.wasPressed ? 'Hide' : 'Show'}">
    <f:ajax listener="#{bean.toggle()}" render="explanation showButton" />
</h:commandButton>

and

<h:panelGroup id="explanation" rendered="#{bean.wasPressed}">
    <h:outputText value="something" />
</h:panelGroup>

The bean.toggle() simply sets the wasPressed property to true or false appropriately. I am using <h:form prependId="false">.

The problem is the value of the render attribute of my button. It explicitly enlists both: explanation and showButton.

As long as the showButton is always present (it only changes its label), the explanation is present only if the wasPressed property is true. Otherwise it says:

malformedXML: During update: explanaition not found

How can I solve this problem?

I would like not to revert to hiding the element in the source code, so I would like not to use any jQuery toggle(-) or any way of hiding the element using style="display: none" or any of this stuff.

Is it even achievable in JSF 2.1?

  • 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-15T15:08:57+00:00Added an answer on June 15, 2026 at 3:08 pm

    You cannot update elements which are not rendered , rendered=false “is a JSF way to” to remove elements from the DOM Tree ,

    its not like css display:none or visibility:hidden <- this two will keep the elements in the DOM tree but hidden , while the JSF rendered=false wont even render (keep) the element in the DOM tree (you wont even see it in the “view source” of the page)

    So in you case you need to wrap the panelGroup with another `panelGroup’ and update the id of the wrapper

    <h:commandButton id="showButton" value="#{bean.wasPressed ? 'Hide' : 'Show'}">
        <f:ajax listener="#{bean.toggle()}" render="explanationWrapper showButton" />
    </h:commandButton>
    
    
    <h:panelGroup id="explanationWrapper">
        <h:panelGroup id="explanation" rendered="#{bean.wasPressed}">
            <h:outputText value="something" />
        </h:panelGroup>
    </h:panelGroup>
    

    also look at similar question

    Can you update an h:outputLabel from a p:ajax listener?

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

Sidebar

Related Questions

I have a component that i want to store to an SQLite database. public
Say I have a web component that uses jQuery and I want to distribute
I have a component where i want to display a custom jtooltip. That is
I'm looking for a way to show/hide an arbitrary RichFaces component. In this case,
I have a TWebBrowser component that show a Google maps page. The problem is
We want to show a hint for a JList that the user can select
I have a mvc3 razor helper that show a component: @helper Component(string params){ <div
I have a custom component location . I want that, when a change is
I have to add a message to show the user that he has made
i want to build a component that will be able to show a integer

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.