2 Replies Latest reply on Dec 7, 2012 9:25 AM by robinho

    Alternative for Richfaces.hideModalPanel('id')

    robinho Newbie

      Hey everyone,


      I am migrating my application from RF 3.3.2 to RF 4.2.3 right now and i've been wondering if there is a alternative for the Richfaces.hideModalPanel() function.

      My use case is a popupPanel that gets closed by a commandButton when no errors have occured. This is my Button.


      <a4j:commandButton value="#{msg.action_save}" type="submit"



                                      oncomplete="#{facesContext.maximumSeverity != 'Error' ? 'Richfaces.hideModalPanel(\'savePanel\');':'return 0;'}" />


      So the problem is, in this construction where i check for Errors I can not use the #{rich:component('savePanel')}.hide() method

      and the Richfaces.hideModalPanel is no longer available in RF4

      Is there a good alternative for this?


      Thanks in advance

        • 1. Re: Alternative for Richfaces.hideModalPanel('id')
          Michal Petrov Master



          if you're not closing the panel when there are errors, why not get rid of the ternary operator?

          oncomplete="if(#{facesContext.maximumSeverity != 'Error'})#{rich:component('savePanel'}}.hide();"


          this might also work:

          data="#{facesContext.maximumSeverity}" oncomplete="if(event.data != 'Error')#{rich:component('savePanel'}}.hide();"


          Or you can do it like this:

          oncomplete="#{facesContext.maximumSeverity != 'Error'} ? #{rich:component('savePanel'}}.hide(); : return 0"


          And if you really want to use rich:component inside the EL expression you can (but I wouldn't do that):

          oncomplete="#{facesContext.maximumSeverity != 'Error' ? rich:component('savePanel').concat('.hide()'):'return 0;'}"