Form onsubmit event handler for Zone components does not work if any fields on 
the form have validation configured.
-------------------------------------------------------------------------------------------------------------------

                 Key: TAPESTRY-2418
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2418
             Project: Tapestry
          Issue Type: Bug
          Components: JavaScript
    Affects Versions: 5.0.12
         Environment: Windows Vista Home Premium, 
Firefox 2.0.0.14,
Internet Explorer 7.0.6000.16643,
            Reporter: Eric Rogers


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);
    }  
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to