I''m not clear on whether you have many forms or many inputs, but by far
the easiest solution is to use good ole'' HTML markup with a single
form.
Be sure to set the name property for every input element that you want
included in the post, you can use arrays [] and hashes [key], even
combinations of the two, or just unique names (if not an array or hash
and not unique, they will be overridden server-side).
<form id="myform">
<input name="data1" ... />
<input name="data2" ... />
<input name="arrayone[]" ... />
<input name="arrayone[]" ... />
<input name="hashone[keyone]" ... />
<input name="hashone[keytwo]" ... />
</form>
<div id="myResult''></div>
<script type="text/javascript">
new
Ajax.Updater(''myResult'',''index.php?action=receive'',{
parameters: Form.serialize(''myform'')
});
</script>
Post is the default method so no need to specify. If you *must* have
multiple forms you could join the results using this:
parameters:
[''form1id'',''form2id'',''form3id''].collect(Form.serialize).join(''&'')
I love Form.serialize.
Colin
Exerior wrote:> I am using prototype 1.5
>
> I have a very complex form with lots of data. For example 100 input
> fields. Now i need to send these data to the server like it is a
> normal form post. The server-side should think the data are sended
> with method=post.
>
> Here is a code sample (the real code is two long, so i wrote a code to
> demonstrate my problem):
>
>
> <form id=myInput method=post action=index.php>
> <input .... > </form> <!-- many forms -->
>
> <div id=myResult></div>
>
> <script type=\"text/javascript\"
language=\"javascript\">
> new Ajax.Updater(''myResult'',
''index.php?action=recieve'', { method:
> post });
> </script>
>
>
> How do i add the form data to the updater?
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---