You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2012/08/18 02:47:38 UTC

[jira] [Closed] (TAP5-1859) Clicking a submit or button in a non-Tapestry Form causes a client exception

     [ https://issues.apache.org/jira/browse/TAP5-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAP5-1859.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 5.3.5

Based on the work that's already gone on in 5.4, I don't think this bug affects that code anymore; for example, there is no FormEventManager anymore.
                
> Clicking a submit or button in a non-Tapestry Form causes a client exception
> ----------------------------------------------------------------------------
>
>                 Key: TAP5-1859
>                 URL: https://issues.apache.org/jira/browse/TAP5-1859
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.2
>            Reporter: Paul Stanton
>            Assignee: Howard M. Lewis Ship
>              Labels: FormEventManager, form, submit
>             Fix For: 5.3.5
>
>
> When submitting a html form which was not constructed using the tapestry Form component, tapestry.js still attempts to acquire a Tapestry.FormEventManager, resulting in an uncaught JS exception.
> TML test case:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter">
> 	<t:zone t:id="dum" /><!-- make sure js is loaded into page -->
> 	<head></head>
> 	<body>
> 		<form>
> 			<input type="submit" />
> 		</form>
> 	</body>
> </html>
> Excerpt from tapestry.js:
>         getFormEventManager : function(form) {
>             form = $(form);
>             var manager = $T(form).formEventManager;
>             if (manager == undefined) {
>                 throw "No Tapestry.FormEventManager object has been created for form '#{id}'."
>                     .interpolate(form);
>             }
>             return manager;
>         },
> is called by:
>         setSubmittingElement : function(form, element) {
>             form.getFormEventManager()
>                 .setSubmittingElement(element);
>         },
> is called by:
>         /*
>          * When a submit element is clicked, record the name of the element into
>          * the associated form. This is necessary for some Ajax processing, see
>          * TAPESTRY-2324.
>          *
>          * TAP5-1418: Added "type=image" so that they set the submitting element
>          * correctly.
>          */
>         $$("INPUT[type=submit]", "INPUT[type=image]").each(function(element) {
>             var t = $T(element);
>             if (!t.trackingClicks) {
>                 element.observe("click", function() {
>                     $(element.form).setSubmittingElement(element);
>                 });
>                 t.trackingClicks = true;
>             }
>         });
> The solution is probably to add a check within this last snippet to make sure you are dealing with a tapestry form:
>             // skip if this is not a tapestry controlled form
>             if (this.form.getInputs("hidden", "t:formdata").size() == 0)
>                 return;
> The above is taken from elsewhere in tapestry.js.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira