0
votes

I have a clickable image in a multi-tab tabbed table. The onclick event has two action groups (under one parent action group) with conditions. Each action group has one action. The first action group condition is "return false". Its action is a confirm that says "Test 1". The second action group condition is "return true" and its action is a confirm that says "Test 2".

When the above clickable image is anywhere but inside the tabbed table except the default tab, it appears to ignore the condition tests and as a result, both actions are triggered. If the image is inside the default tab, or if it outside of the tabbed table, it works as expected, showing on the second action (Test 2).

Note: If I replace the confirm actions with execute script actions, the conditions work. It appears this is specific to confirm actions.

Here is a sample of the clickable image code.

<xp:image url="/my.gif" id="image1" alt="Click here" style="cursor:hand;height:16.0px;width:17.0px">
  <xp:eventHandler event="onclick" submit="true" refreshMode="complete" id="eventHandler1">
    <xp:this.action>
      <xp:actionGroup>
        <xp:actionGroup condition="#{javascript:return false;}">
          <xp:confirm message="Test 1"></xp:confirm>
          <xp:executeScript>
            <xp:this.script><![CDATA[#{javascript:try{
              var val = getComponent("cfMessage").getValue();
              getComponent("cfMessage").setValue("test 1")}
              catch(e){}}]]>
            </xp:this.script>
          </xp:executeScript>
        </xp:actionGroup>

        <xp:actionGroup condition="#{javascript:return true;}">
          <xp:confirm message="Test 2"></xp:confirm>
          <xp:executeScript>
            <xp:this.script><![CDATA[#{javascript:try{
              var val = getComponent("cfMessage").getValue();
              getComponent("cfMessage").setValue(val+", test 2")}
              catch(e){}}]]>
            </xp:this.script>
          </xp:executeScript>
        </xp:actionGroup>
      </xp:actionGroup>
    </xp:this.action>
  </xp:eventHandler>
</xp:image>

The tabbed table that contains this code is unexceptional. I drug a new tabbed table control onto the page, created two tabs, and added clickable images to both tab panels.

Thoughts?

1
Try to compare rendered html in both cases.Frantisek Kossuth
When the default tab is open, the html renders XSP.attachEvent and related code only the "true" action groups for every clickable image, inside or outside of the tabbed table. When another tab other than the default is active, the html renders both action groups (true and false) for each clickable image, inside and outside of the tabbed table. In the latter case, the appropriate confirm actions still work for most of the clickable images (except non-default tab images).John E
Additional info...I changed the default tab to be the second tab (of two) instead of the first and now the clickable image on the second tab works correctly and the one on the first tab does not work correctly (both action group actions trigger).John E
pls, attach source of the eventFrantisek Kossuth
@FrantisekKossuth - I have updated the original post to include the code.John E

1 Answers

0
votes

As you already noticed, it's not related to Tabbed panel.

What I found is that after a partial refresh on the component, XPages does not care condition attribute if it has client side interaction.

It seems like a bug (and a similar one is known since 8.5.2)

I would create two different images with different set of actions and control visibility with rendered tags.