Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-2472

incorrect zone id javascript mapping with page having more than 1 of same component containing a zone

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 5.0.13, 5.0.14
    • None
    • None
    • jetty 6.1.9, java 1.6, os x, linux

    Description

      When a page contains more than one of the same component (either multiple inclusions or inside a loop) and the component contains a zone with an actionlink that updates this zone then only the zone of the first component instance gets updated in all actionlink-clicks of all components.

      It appears as if the Tapestry javascript initialization mapping parameters are incorrect:

      This is what gets generated:
      Tapestry.DEBUG_ENABLED = true;
      Tapestry.onDOMLoaded(function() {
      Tapestry.init(

      {"zone":["zone1","zone1_0"],"linkZone":[["update","zone1"],["update_0","zone1"]]}

      );
      });

      It should be:
      ...
      Tapestry.init(

      {"zone":["zone1","zone1_0"],"linkZone":[["update","zone1"],["update_0","zone1_0"]]}

      );
      ...

      Below is more detailed information including code examples:

      I get the correct result after clicking on
      the "update: two" hyprlink (the correct zone is updated):

      update: one (hyperlink)
      UPDATED two

      BUT when I modify the page .tml and put the body inside a
      <html><body>...</body></html> in stead of only inside a
      <html>...</htm>

      The following html source get generated by tapestry at the bottom of
      the page and...

      <!--
      Tapestry.DEBUG_ENABLED = true;
      Tapestry.onDOMLoaded(function() {
      Tapestry.init(

      {"zone":["zone1","zone1_0"],"linkZone":[["update","zone1"],["update_0","zone1"]]}

      );
      });
      // -->

      ...and the result is incorrect ("zone1_0" should have been updated and
      not "zone1"):

      UPDATED two
      update: two (hyperlink)

      Here is all the code:

      Page code:

      ZonePage.tml

      <html xmlns:t = "http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
      <t:zonecomp>one</t:zonecomp>
      <br/>
      <t:zonecomp>two</t:zonecomp>
      </html>

      public class ZonePage {
      }

      Component Code:

      ZoneComp.tml

      <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
      <t:zone t:id="zone1" visible="true">
      <t:delegate to="prop:activeBlock"/>
      </t:zone>
      <t:block t:id="beforeUpdate">
      <t:actionlink t:id="update" zone="zone1">update:
      <t:body/></t:actionlink>
      </t:block>
      <t:block t:id="afterUpdate">
      <p>UPDATED <t:body/></p>
      </t:block>
      </t:container>

      public class ZoneComp {

      @Persist("session")
      private boolean updated = false;

      @Inject
      private Block beforeUpdate;

      @Inject
      private Block afterUpdate;

      @Component(id="zone1")
      private Zone zone;

      public Object onActionFromUpdate()

      { updated = true; return zone; }

      public Object getActiveBlock()

      { if (updated) return afterUpdate; return beforeUpdate; }

      }

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            mike.oestereter Mike Oestereter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: