9 Replies Latest reply on Mar 5, 2012 3:56 AM by tomek.f

    commandButton action not firing after reenabling

    tomek.f

      Hello.

       

      I have commandButton with disbaled="true". After rerendering I set disabled="false", but action is not fired when button is clicked. Where canbe the problem?

       

      Regards,

      Tomek.

        • 1. Re: commandButton action not firing after reenabling
          healeyb

          Can you show the surrounding code? is it a a4j:commandButton? which RF version are you using? Have you

          tried it with disabled="false", does it ever work?

          • 2. Re: commandButton action not firing after reenabling
            tomek.f

            <a4j:commandButton id="saveButton" action="#{bean.save}" disabled="#{bean.saveButtonDisabled}"

                                                                                         execute="@form" value="Save" />

             

            <a4j:jsFunction name="enableButton" render="saveButton" id="enableSaveButtonFunction">

                 <a4j:param assignTo="#{bean.saveButtonDisabled}" name="disabled" value="#{false}" />

            </a4j:jsFunction>

            • 3. Re: commandButton action not firing after reenabling
              sunkaram

              did you check if button is enabled after rerendering?

              I enable/disable button in my app based on bean property, its works perfectly fine.. I used action method to change flag not <a4j:jsFunction with param.

              • 4. Re: commandButton action not firing after reenabling
                healeyb

                for testing purposes why not just delete the disabled= attribute. I expect that you'l find that the action ( save() ) won't

                fire anyway. This is most likely to be because the component is failing validation. Add an h:messages tag to the page.

                Assuming that the commandButton is in a form...

                • 5. Re: commandButton action not firing after reenabling
                  tomek.f

                  @ Maheswara So do you enable disable with bean property? I have to enable button after input field blur.

                   

                  @ Brendan Yes it works without that attribute. i have messages doesnt show anything. It is in a form.

                  • 6. Re: commandButton action not firing after reenabling
                    healeyb

                    You need to post the code dude. Is the button resident within a component that uses rendered=?

                    • 7. Re: commandButton action not firing after reenabling
                      tomek.f

                      @ Brendan Sry but I cannot understand your question. Mycode:

                       

                      <h:form id="popupForm" prependId="false" >

                                     

                                      <rich:graphValidator value="#{flightEdit}" id="gv1">

                                      /* ... */

                                             

                                              <f:facet name="footer">

                                                  <rich:panel id="saveButtonPanelFooter">

                                                      

                                                      <a4j:commandButton id="saveButton" action="#{bean.save}" disabled="#{bean.saveButtonDisabled}" 

                                                                     execute="@form" value="Save" />

                       

                                                  </rich:panel>

                                              </f:facet>

                                          </h:panelGrid>

                                      </rich:graphValidator>

                       

                       

                                      <a4j:jsFunction name="enableButton" render="saveButton" id="enableSaveButtonFunction">

                                          <a4j:param assignTo="#{bean.saveButtonDisabled}" name="disabled" value="#{false}" />

                                      </a4j:jsFunction>

                                     

                                    

                                  </h:form>

                       

                      After clicking the button it renders and is enabled.

                      • 8. Re: commandButton action not firing after reenabling
                        sunkaram

                        Yes, I enable/disable based on bean property.

                         

                        instead of rendering just button (which is disabled), try rendering 'saveButtonPanelFooter' which is wrapper to save button.

                        • 9. Re: commandButton action not firing after reenabling
                          tomek.f

                          Ok. Problem was somewhere else and after fixing it it of course works. Sry. Thread to delete.