6 Replies Latest reply on May 15, 2008 9:08 AM by ilya_shaikovsky

    commandButton and toggleControl

    bostone

      Is it possible to combine a4j:commandButton and rich:toggleControl? Basically I have 2 state toggle panel. In the first view I have simple search form (text field + button). I would like to execute search and move to the next view which has search result table.
      Any suggestions will be greatly appreciated

        • 1. Re: commandButton and toggleControl
          bostone

          OK. the following works, the only beef I have with it - it seem to render panel first, then goes to search and then repaints the table which looks pretty ugly

          <rich:toggleControl for="searchTogglePanel" stateOrder="step2" >
           <a4j:commandButton value="Search"
           actionListener="${deviceMasterFormBean.search}" reRender="searchResultPanel" />
          </rich:toggleControl>
          


          • 2. Re: commandButton and toggleControl
            ilya_shaikovsky

            why you need to use both controls. Yes it will be works as you see :)


            Use just one toggle control. Your togglePanel should be in ajax mode. Specify actionListener and nothing to reRender on the control. This should just works as you need.

            • 3. Re: commandButton and toggleControl
              bostone

               

              "ilya_shaikovsky" wrote:

              Use just one toggle control. Your togglePanel should be in ajax mode. Specify actionListener and nothing to reRender on the control. This should just works as you need.


              I understand that toggleControl will work by itself, but it renders a link and I need a button, anything I'm missing here?

              • 4. Re: commandButton and toggleControl
                ilya_shaikovsky

                yes this is an issue. http://jira.jboss.com/jira/browse/RF-3428

                but you should not place command control inside other command control in any way. In the result two requests will be sent so behaviour will not be right.

                As workaround you may place hidden control on the page and just button element with type = button (in order not to perform submit) and click on the toggle control via JS.

                • 5. Re: commandButton and toggleControl
                  bostone

                  Thanks Ilia. I would also point that you guys already have nested controls by allowing rich:componentControl to be wrapped by link or button tags. I was actually trying to use it to toggle a panel just couldn't figured out how

                  • 6. Re: commandButton and toggleControl
                    ilya_shaikovsky

                    rich:component control - doesn't send any requests. It's just calls JS API on the target component. Unfortunatelly togglePanel miss this API for now. So try to use my workaround.