diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-08 22:12:40 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-08 22:12:40 +0000 |
commit | 2c6747f858481efa1bc3612e955861c13dc1c95b (patch) | |
tree | 777b1c89efc19de11922738f4a58e7fe19f3cd37 /actionpack/lib/action_view/helpers | |
parent | e2d8451024b074ff467b6264edb17f2758322f3e (diff) | |
download | rails-2c6747f858481efa1bc3612e955861c13dc1c95b.tar.gz rails-2c6747f858481efa1bc3612e955861c13dc1c95b.tar.bz2 rails-2c6747f858481efa1bc3612e955861c13dc1c95b.zip |
Split Form.serialize into Form.serialize and Form.serializeElements. The latter can be used stand-alone to serialize an array of elements you pass in, instead of the entire form [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5077 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/prototype.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js index 81428620f6..3ebb63add8 100644 --- a/actionpack/lib/action_view/helpers/javascripts/prototype.js +++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js @@ -1594,7 +1594,10 @@ var Form = { Form.Methods = { serialize: function(form) { - var elements = Form.getElements($(form)); + this.serializeElements(Form.getElements($(form))); + }, + + serializeElements: function(elements) { var queryComponents = new Array(); for (var i = 0; i < elements.length; i++) { @@ -1603,7 +1606,7 @@ Form.Methods = { queryComponents.push(queryComponent); } - return queryComponents.join('&'); + return queryComponents.join('&'); }, getElements: function(form) { @@ -1615,6 +1618,7 @@ Form.Methods = { for (var j = 0; j < tagElements.length; j++) elements.push(tagElements[j]); } + return elements; }, |