Tapestry 5
  1. Tapestry 5
  2. TAP5-1210

MultiZone update from EventLink with Form fails in Internet Explorer

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.2.0
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      A MultiZone update currently fails in Internet Explorer given the below template. This works fine in Chrome and Firefox. There appears to be an instance where purge() in tapestry.js is looping over elements, hits a null element, and blows up trying to access .name on it. Hit the "Click Me" link; notice the date does not update.

      .tml:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html title="IE Test"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
      xmlns="tapestry:parameter">

      <t:zone t:id="messageZone" id="messageZone">
      $

      {curTime}


      </t:zone>

      <t:form t:id="testForm" autofocus="false" zone="messageZone">

      <t:zone t:id="formZone" id="formZone">

      <t:eventlink event="clicked" zone="formZone">Click Me!</t:eventlink>

      <t:textfield t:id="testName" value="testValue" class="testing" maxlength="50"
      onKeyPress="javascript:blur();"
      onBlur="javascript:$('testForm').fire(Tapestry.FORM_PROCESS_SUBMIT_EVENT);"/>

      </t:zone>

      </t:form>

      </html>

      .java:

      import org.apache.tapestry5.ajax.MultiZoneUpdate;
      import org.apache.tapestry5.annotations.InjectComponent;
      import org.apache.tapestry5.annotations.Property;
      import org.apache.tapestry5.corelib.components.Zone;

      import java.util.Date;

      public class IeTest
      {
      @Property
      private String testValue;

      @InjectComponent
      private Zone messageZone;

      @InjectComponent
      private Zone formZone;

      @Property
      private Integer curField;

      void setupRender()

      { testValue = "test"; }

      public String getCurTime()

      { return new Date().toString(); }

      Object onClicked()

      { return new MultiZoneUpdate("messageZone", messageZone.getBody()) .add("formZone", formZone.getBody()); }

      Object onSuccess()

      { return messageZone.getBody(); }

      }

        Activity

        Hide
        Ben Dotte added a comment -

        This is fixed by adding a conditional if (attrs[i]) inside of the purge() function of tapestry.js like so:

        var attrs = element.attributes;
        if (attrs) {
        var l = attrs.length, i, name;
        for (i = 0; i < l; i++) {
        if (attrs[i])
        {
        name = attrs[i].name;
        /* Looking for onclick, etc. */
        if (typeof element[name] == 'function')

        { element[name] = null; }

        }
        }
        }

        Show
        Ben Dotte added a comment - This is fixed by adding a conditional if (attrs [i] ) inside of the purge() function of tapestry.js like so: var attrs = element.attributes; if (attrs) { var l = attrs.length, i, name; for (i = 0; i < l; i++) { if (attrs [i] ) { name = attrs [i] .name; /* Looking for onclick, etc. */ if (typeof element [name] == 'function') { element[name] = null; } } } }
        Hide
        Ben Dotte added a comment -

        Code fix from comment applied.

        Show
        Ben Dotte added a comment - Code fix from comment applied.
        Hide
        Hudson added a comment -

        Integrated in tapestry-5.2-freestyle #159 (See http://hudson.zones.apache.org/hudson/job/tapestry-5.2-freestyle/159/)

        Show
        Hudson added a comment - Integrated in tapestry-5.2-freestyle #159 (See http://hudson.zones.apache.org/hudson/job/tapestry-5.2-freestyle/159/ )

          People

          • Assignee:
            Ben Dotte
            Reporter:
            Ben Dotte
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development