3 Replies Latest reply on Sep 20, 2010 7:22 PM by akaine

    validation modal panel for h:commandButton

    akaine

      I always used the generic solution for a4j:commandButton which is pretty easy to develop and as I've just seen there are tons of references to this one including http://community.jboss.org/wiki/ModalPanelValidation. Still I could not find any for the h:commandButton since it doesn't have oncomplete attribute and doesn't handle ajax requests.

       

      - Is it possible to check for errors on form submit and open a modal panel with the error list if there are any using the h:commandButton?

       

      Thanks in advance.

        • 1. Re: validation modal panel for h:commandButton
          sivaprasad9394

          I think in h:commandButton you can't achieve this ,try like this

           

          ajax commandButton

           

          oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editBlacklistingModal')}.hide();"

           

           

          <a4j:commandButton value="Submit" action="#{.......}" reRender="SampleModal"

          oncomplete="if (#{facesContext.maximumSeverity!=null}) #{rich:component('SampleModal')}.show();" />

           

          Inside modelpanel use h:messages or rich:messages

          • 2. Re: validation modal panel for h:commandButton
            liuliu

            hi,

            you can do it with h:commandbutton, you need to use showWhenRendered="#{not (facesContext.maximumSeverity==null)}"

            1 of 1 people found this helpful
            • 3. Re: validation modal panel for h:commandButton
              akaine

              sivaprasad krishnaswamy wrote:

               

              I think in h:commandButton you can't achieve this ,try like this

               

              ajax commandButton

               

              oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editBlacklistingModal')}.hide();"

               

               

              <a4j:commandButton value="Submit" action="#{.......}" reRender="SampleModal"

              oncomplete="if (#{facesContext.maximumSeverity!=null}) #{rich:component('SampleModal')}.show();" />

               

              Inside modelpanel use h:messages or rich:messages

               

              As I mentionned in the first post I am using the a4j approach. I was trying to change AJAX to JSF submits only because of some RF bugs.

               

              liumin hu wrote:

               

              hi,

              you can do it with h:commandbutton, you need to use showWhenRendered="#{not (facesContext.maximumSeverity==null)}"

              I see the problem clearly now. Yes, that is the correct answer in pure JSF submit terms. Thanks.
              I understood that I must search for the solution in other place. This is not the first time I have problems because of using RF AJAX forwarding mechanism.