3 Replies Latest reply: Jul 3, 2012 2:06 AM by 940981 RSS

    How to show popup after invoke one action?

    940981
      Is it possible to show one pupup direct after invoking one method in backbean?

      I wrote the code as following,

      <amx:commandButton id="commandButton8" icon="/images/add.png"
      actionListener="#{bindings.findContact.execute}">
      <amx:setPropertyListener from="#{bindings.firstName.inputValue}" to="#{pageFlowScope.firstname}"
      type="action"/>
      <amx:setPropertyListener from="#{bindings.lastName.inputValue}" to="#{pageFlowScope.lastname}"
      type="action"/>
      <amx:showPopupBehavior popupId="contact" align="overlapBottom" alignId="pp1"/>
      </amx:commandButton>

      The method findContact will change the value of variable in the backbean, then the text in the popup should be shown according to the value. But now the popup is loading before the value changed.

      I can solve this problem if I use another view(page) instead of popup. But I really want to show the popup/dialog in the middle of page, can anyone give some suggestion?
        • 1. Re: How to show popup after invoke one action?
          Joe Huang-Oracle
          Hi, Zhiyang, you should be able to add the setPropertyListener statements inside the Close Button for the pop up window. There is an example of how to add a button and then add the ClosePopupBehavior to the button to close the popup. You should be able to set the values inside the same button in the popup.

          Is this what you want to do - set the values after the popup is closed?

          Thanks,

          Joe Huang
          • 2. Re: How to show popup after invoke one action?
            Denis T
            The order of events is what you are hitting. Command components follow this order:

            1) Process all child behavior tags in order they appear
            2) Process the "actionListener" attribute
            3) Follow any "action" specified in that attribute

            To achieve what you want, you need to move your actionListener down as a child tag instead. To meet this need, we created an actionListener child behavior. Your code would become:

            <amx:commandButton id="commandButton8" icon="/images/add.png">
            <amx:setPropertyListener from="#{bindings.firstName.inputValue}" to="#{pageFlowScope.firstname}" type="action"/>
            <amx:setPropertyListener from="#{bindings.lastName.inputValue}" to="#{pageFlowScope.lastname}" type="action"/>
            <amx:actionListener binding="#{bindings.findContact.execute}" type="action"/>
            <amx:showPopupBehavior popupId="contact" align="overlapBottom" alignId="pp1"/>
            </amx:commandButton>