7 Replies Latest reply on Aug 27, 2009 4:12 AM by ilya_shaikovsky

    showing modal panel with onblur

      Hi:
      I would like to show a modal panel when an onblur event happens after filling a field.
      I tried this but it doesn´t work:

      <s:decorate id="c4" template="layout/edit.xhtml" >
       <ui:define name="label">#{messages['view.internationalorderedit.isin']}</ui:define>
       <h:inputText id="isin" size="16" maxlength="12" style="text-transform:uppercase"
       value="#{order.asset.asset.isin}"
       label="#{messages['view.internationalorderedit.isin']}" >
       <a4j:support event="onblur"
       action="Richfaces.showModalPanel('internationalForm:panel')"
       />
       <f:validator validatorId="boleta.ISINValidator" />
       </h:inputText>
       <h:outputText value="#{assetName}" />
       </s:decorate>
      


      any tip? thanks in advance!

        • 1. Re: showing modal panel with onblur
          ilya_shaikovsky

          move modal call from action to oncomplete.

          • 2. Re: showing modal panel with onblur

            thank you very much for your quick response!
            It works but I need something more.
            I want an action to be performed when onblur event is fired, and a modal panel to be displayed while the action is executed. When the action has finished I would like the modal panel to be closed. With a link or button I open the model panel with onclick and close with oncomplete, but in this case onclick is no possible.
            So I would like something like this, with xxx being a suitable way.

            <a4j:support event="onblur"
            xxx="Richfaces.showModalPanel('internationalForm:panel')"
            action="#{internationalOrderManager.findIsin}"
            oncomplete="Richfaces.hideModalPanel('internationalForm:panel')"
             />
            




            • 3. Re: showing modal panel with onblur
              ilya_shaikovsky

              so you just want request status panel?

              but in this case onclick is no possible.
              I'm lost there :/

              • 4. Re: showing modal panel with onblur

                Thanks again, I´ll explain it deeply:
                I have this:

                 <a4j:region id="isinReg">
                
                 <s:decorate id="c4" template="layout/edit.xhtml" >
                 <ui:define name="label">#{messages['view.internationalorderedit.isin']}</ui:define>
                 <h:inputText id="isin" size="16" maxlength="12" style="text-transform:uppercase"
                 value="#{order.asset.asset.isin}"
                 required="#{!internationalOrderManager.newEmission}"
                 disabled="#{internationalOrderManager.newEmission}"
                 label="#{messages['view.internationalorderedit.isin']}" >
                 <a4j:support event="onblur" action="#{internationalOrderManager.findIsin}"/>
                 <f:validator validatorId="boleta.ISINValidator" />
                 </h:inputText>
                 <h:outputText value="#{assetName}" />
                 </s:decorate>
                 <a4j:status startText="Performing action..." stopText="" for="isinReg"/>
                
                 </a4j:region>
                
                


                It works, the matter is that while the action is performing I would like to prevent the user from doing anything in the form until the action has finished. That´s why I thought using a modal panel was a good idea.
                I already use that with ajax links or buttons and it´s a fine solution.
                For instance:

                <a4j:commandButton
                 onclick="#{rich:component('login:panel')}.show()"
                 oncomplete="#{rich:component('login:panel')}.hide()"
                 action="#{internationalOrderManager.confirmWithoutConfirm()}"
                 value="#{messages['Confirwithoutconfirm']}"
                />
                


                But in my current case action is fired with an onblur event, and a:support has no "onclick", it has "action" to launch teh action, "complete" where I could hide the panel, but no "onclick" to show it.

                Is there a way to prevent the user from doing anything in the form until the onblur action has finished?



                • 5. Re: showing modal panel with onblur
                  ilya_shaikovsky

                  finally got it :) for support - use onsubmit event. And b.t.w. as described in our wiki - status component usage for such case implementation - much more easier.

                  • 6. Re: showing modal panel with onblur

                    thank you, that´s what I was looking for. I´ve checked wiki, I guess you mean thie following, don´t you?

                    http://www.jboss.org/community/wiki/RichFacesPleaseWaitBox

                    • 7. Re: showing modal panel with onblur
                      ilya_shaikovsky

                      yup! Ping us if any problem will appears.