Hello everybody,
I tried for a couple of days to get my form serialized before posting
it as an AJAX-request. This is my code:
<form action="" method="post"
name="theform" id="theform">
<input type="checkbox" name="chkbox"
value="1">
<p>
<label for="alt_search" class="left">Search
for:</label>
<input id="searchText" name="livesearch"
class="field" />
<script>
new Form.Element.Observer(''searchText'', 1,
function(element, value)
{
new Ajax.Updater(''search_results'',
''livesearch.php'',
{
asynchronous:true,
evalScripts:true,
onComplete:function(request)
{Element.hide(''search_spinner'')},
onLoading:function(request)
{Element.show(''search_spinner'')},
method:''post'',
parameters:''livesearch='' + value
})
})
</script>
</p>
</form>
I´d like to get the chkbox-value (and possibly others) sent to the
livesearch.php-script as well, as soon as anything in the form changes
- and after submiting the form, of course, it´d be nessecary to be
able to access the "whole form-content". Any idea, anybody?
Thanks for your help!
Christoph
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
I''d start by using less anonymous functions in your options parameter
for the Ajax.Updater request. That is a PIA to read.
You''re not using the form.serialize method, try...
parameters : $("theform").serialize(),
On Jun 19, 5:15 pm, ChristophN
<christ...-WDEXVOHJCzGsTnJN9+BGXg@public.gmane.org>
wrote:> Hello everybody,
>
> I tried for a couple of days to get my form serialized before posting
> it as an AJAX-request. This is my code:
>
> <form action=""
method="post" name="theform" id="theform">
> <input
type="checkbox" name="chkbox" value="1">
> <p>
> <label
for="alt_search" class="left">Search for:</label>
> <input
id="searchText" name="livesearch" class="field"
/>
> <script>
> new
Form.Element.Observer(''searchText'', 1,
>
function(element, value)
> {
> new
Ajax.Updater(''search_results'',
''livesearch.php'',
> {
>
asynchronous:true,
>
evalScripts:true,
>
onComplete:function(request)
>
{Element.hide(''search_spinner'')},
>
onLoading:function(request)
>
{Element.show(''search_spinner'')},
>
method:''post'', parameters:''livesearch='' +
value
> })
> })
> </script>
> </p>
> </form>
>
> I´d like to get the chkbox-value (and possibly others) sent to the
> livesearch.php-script as well, as soon as anything in the form changes
> - and after submiting the form, of course, it´d be nessecary to be
> able to access the "whole form-content". Any idea, anybody?
>
> Thanks for your help!
>
> Christoph
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---