From 2c6747f858481efa1bc3612e955861c13dc1c95b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 8 Sep 2006 22:12:40 +0000 Subject: 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 --- actionpack/lib/action_view/helpers/javascripts/prototype.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers') 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; }, -- cgit v1.2.3