You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2013/07/16 18:09:59 UTC

[2/2] git commit: TAP5-2141: Ajax form submission should ignore fields with no name

TAP5-2141: Ajax form submission should ignore fields with no name


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a8ad6d26
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a8ad6d26
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a8ad6d26

Branch: refs/heads/master
Commit: a8ad6d265d98bb379df64b941af3922406c06394
Parents: c8bb56e
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jul 16 09:09:52 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jul 16 09:09:52 2013 -0700

----------------------------------------------------------------------
 .../src/main/coffeescript/META-INF/modules/t5/core/forms.coffee | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a8ad6d26/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee
index e66fa09..ef9cff1 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/forms.coffee
@@ -82,6 +82,11 @@ define ["./events", "./dom", "./builder", "underscore"],
 
           name = field.element.name
 
+          # Many modern UIs create name-less elements on the fly (e.g., Backbone); these may be mixed
+          # in with normal elements managed by Tapestry but should be ignored (not sent to the server in a POST
+          # or Ajax update).
+          return if name is ""
+
           existing = result[name]
 
           if _.isArray existing