Tapestry
  1. Tapestry
  2. TAPESTRY-2418

Form onsubmit event handler for Zone component handling is ignored if any fields on the form have validation configured.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 5.0.12
    • Fix Version/s: 5.0.13
    • Component/s: JavaScript
    • Labels:
      None
    • Environment:
      Windows Vista Home Premium,
      Firefox 2.0.0.14,
      Internet Explorer 7.0.6000.16643,

      Description

      If I have a page containing a form and an associated Zone component to update, everything works as expected. However, when I add validation to a field on the form, the submission for the form is treated as a non-AJAX submission.

      More specifically, from looking at the tapestry.js script, it appears that when the page is loaded, the form's onsubmit event handler is at first bound properly. However, the Tapestry.FormEventManager appears to rebind the onsubmit event to its own handleSubmit function, completely ignoring the previous event handler.

      Below is some code for a Test page, which I created to demonstrate the issue:

      Test.tml:

      <t:Zone t:id="statusZone"/>

      <t:Form t:Zone="statusZone">

      <t:TextField t:id="name" t:value="name"/>

      <t:Submit/>

      </t:Form>

      Test.java:

      public class Test {

      private String name;

      //if we remove @Validate("required"), everything works as expected.
      @Validate("required")
      public String getName()

      { return name; }

      public void setName(String name)

      { this.name = name; }

      Object onSuccess()

      { JSONObject response = new JSONObject(); response.put("content", "test me"); return new JSONStreamResponse(response); }


      }

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        Duplicates TAPESTRY-2341.

        Show
        Howard M. Lewis Ship added a comment - Duplicates TAPESTRY-2341 .

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Eric Rogers
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development