tags:

views:

21

answers:

1

Hi,

Specifically I refer to this example:

<h:panelgroup>
  <a4j:support event="onlick" action="do1"/>
  <h:commandbutton id="1".../>
  <h:commandbutton id="2".../>
  <h:commandbutton id="3"...>
    <a4j:support event="onlick" action="do2"/>
  </h:commandbutton>
</h:panelgroup>

My questions -

  1. If I click one of the buttons in the panelgroup, will do1() fire?
  2. If I click the third button will do1() and do2() fire? (What'll happen?)

I'm asking instead of just trying in a sandbox because I hope to understand a little behind the scenes why the specific behavior occurs.

Thanks!

+1  A: 

Ok. Tested it and this is the result:

For this Code:

<h:form>
    <h:panelGrid>
        <h:panelGrid style="border: 1px solid #000;">
            <h:outputText value="Panel1" />
            <a4j:support event="onclick" action="#{mrBean.doSupport1}" />
            <h:commandButton action="#{mrBean.doButton}">
            </h:commandButton>
            <h:panelGrid style="border: 1px solid #000;">
                <h:outputText value="Panel2" />
                <a4j:support event="onclick" action="#{mrBean.doSupport2}" />
            </h:panelGrid>
        </h:panelGrid>
    </h:panelGrid>
</h:form>

If I click in panel1 I get:

doSupport1 runs.

If I clock on the button I get:

doSupport1 runs.
doButton runs.

If I click in panel2 I get:

doSupport1 runs.
doSupport2 runs.

So the answer to my question is that all support objects catch events and the order they are called is from father to son.

Ben
+1, lol @ `mrBean`
BalusC