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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:49:49+00:00 2026-05-13T16:49:49+00:00

When I include a ‘disabled’ attribute on an a4j:commandButton, the button’s action is not

  • 0

When I include a ‘disabled’ attribute on an a4j:commandButton, the button’s action is not performed. Taking the ‘disabled’ attribute out causes it to work properly. I am not doing any special validation (that I’m aware of) and am not seeing any validation error messages.

Here is part of my page:

<t:dataTable id="myTable"
             var="region"
             value="#{MyPageBackingBean.regions}"
             width="100%">

...

<a4j:commandButton value="Update"
                   action="#{region.doUpdate}"
                   oncomplete="alert('done');"
                   disabled="#{!empty region && region.messageEmpty}"
                   immediate="true"/>

...

</t:dataTable>

Any ideas? Thanks!

Edit:

I tried setting preserveDataModel=”true” on the t:dataTable to no avail.

I also made a test having an a4j:commandButton and text box with no data table, but the backing bean action is still not being fired:

      <h:form>
     <a4j:region>
        <a4j:outputPanel id="testregion">
        <h:messages id="messages"/>

                          <a4j:status>
                             <f:facet name="start">
                                <h:graphicImage value="/images/progress_indicator.gif"/>
                             </f:facet>
                          </a4j:status>

                       <h:inputTextarea
                             rows="5"
                             value="#{MyPageBackingBean.myValue}"
                             style="width:100%; border: 1px solid #99CCFF;">
                          <a4j:support event="onkeyup"
                                       reRender="testregion"
                                       eventsQueue="messageModificationQueue"
                                       ignoreDupResponses="true"
                                       requestDelay="500"/>
                       </h:inputTextarea>

                       <a4j:commandButton id="doDelete"
                                          value="Delete"
                                          action="#{MyPageBackingBean.dummy}"
                                          reRender="testregion"
                                          disabled="#{empty MyPageBackingBean.myValue}"/>
                    <h:outputText value="#{MyPageBackingBean.myValue}"/>
        </a4j:outputPanel>
     </a4j:region>
  </h:form>

Here is the new backing bean code used for testing:

private String m_myValue = null;
   public String getMyValue()
   {
      return m_myValue;
   }
   public void setMyValue(String value)
   {
      m_myValue = value;
   }
   private String mystr2 = null;
   public String dummy()
   {
      mystr2 = "hello";
      return null;
   }

Thanks!

  • 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-05-13T16:49:50+00:00Added an answer on May 13, 2026 at 4:49 pm

    In HTML world, the disabled attribute causes the name–value attribute pair of any HTML input element (input, select, textarea and button) not being sent to the server side.

    In JSF world, the presense of the name attribute is been used to identify the bean action to be invoked at the server side. However, during apply request values phase of the form submit JSF also checks if the component’s disabled (and rendered) attribtue evaluates true before taking any actions.

    The #{region} is here an iterated table row object of #{MyPageBackingBean.regions} whose isMessageEmpty() getter by default returns true. In the new request of the form submit the #{MyPageBackingBean.regions} is apparently empty which effectlively makes the button disabled. JSF won’t invoke the associated action then.

    To the point, you need to make sure that #{MyPageBackingBean.regions} returns exactly the same datamodel in the subsequent request. Easiest fix is to place the MyPageBackingBean bean in session scope so that it don’t get reinitialized in the subsequent request, but that has more negative side effects as well. Another fix is to rearrange the datamodel loading so that it happens in the bean constructor. As you’re already using Tomahawk’s <t:dataTable>, you need to set its preserveDataModel attribute to true. For more hints about using datatables, you may find this article useful as well: Using Datatables.

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

Sidebar

Ask A Question

Stats

  • Questions 306k
  • Answers 306k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer 0 or EXIT_SUCCESS means success. EXIT_FAILURE means failure. Any other… May 13, 2026 at 9:14 pm
  • Editorial Team
    Editorial Team added an answer http://www.regular-expressions.info and RegExr. RegExr is also available for download. May 13, 2026 at 9:14 pm
  • Editorial Team
    Editorial Team added an answer List<int> mylist = new List<int>() {8,4,6,2,1,5,3,1,7}; List<int> myRange = mylist.GetRange(2,4);… May 13, 2026 at 9:14 pm

Related Questions

When i use php include to include a page in my website all the
I am getting C++ Compiler error C2371 when I include a header file that
This question is about the PHP parsing engine. When I include a file multiple
How would I include a page from the public folder in one of my
I include a JS file in a user control. The host page has multiple

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.