Hello all,
I have some checkbox array like these:
<input type=checkbox name=list[] value="1">Java<br>
<input type=checkbox name=list[] value="2">JavaScript<br>
<input type=checkbox name=list[] value="3">ASP<br>
<input type=checkbox name=list[] value="4">HTML<br>
<input type=checkbox name=list[] value="5">SQL<br>
I want to send the value of list via ajax. My question is, what do I
put in the ''parameters'' for Ajax.updater? I tried the
following to no
avail:
new Ajax.Updater(''tpl'', url, {
method: ''post'',
parameters: {$F(''list'')},
})
Any help please?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
zuzmic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-17 11:48 UTC
Re: Checkbox array and Ajax.updater
Mr_Google wrote:> Hello all, > > I have some checkbox array like these: > > <input type=checkbox name=list[] value="1">Java<br> > <input type=checkbox name=list[] value="2">JavaScript<br> > <input type=checkbox name=list[] value="3">ASP<br> > <input type=checkbox name=list[] value="4">HTML<br> > <input type=checkbox name=list[] value="5">SQL<br> > > I want to send the value of list via ajax. My question is, what do I > put in the ''parameters'' for Ajax.updater? I tried the following to no > avail: >Try this: new Ajax.Updater(''tpl'', url, { parameters: {''list[]'' : $$(''input[name="list[]"]'').findAll(function (el) { return el.checked }).pluck(''value'') }); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
zuzmic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-17 11:51 UTC
Re: Checkbox array and Ajax.updater
On Dec 17, 10:12 am, Mr_Google <kahc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > I have some checkbox array like these: > > <input type=checkbox name=list[] value="1">Java<br> > <input type=checkbox name=list[] value="2">JavaScript<br> > <input type=checkbox name=list[] value="3">ASP<br> > <input type=checkbox name=list[] value="4">HTML<br> > <input type=checkbox name=list[] value="5">SQL<br> > > I want to send the value of list via ajax. My question is, what do I > put in the ''parameters'' for Ajax.updater? I tried the following to no > avail: > > new Ajax.Updater(''tpl'', url, { > method: ''post'', > > parameters: {$F(''list'')}, > }) > > Any help please?Try this new Ajax.Updater(''tpl'', url, { parameters: {''list[]'' : $$(''input[name="list[]"]'').findAll(function (el) { return el.checked }).pluck(''value'') } }) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
zuzmic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-17 11:52 UTC
Re: Checkbox array and Ajax.updater
Try this
new Ajax.Updater(''tpl'', url, {
parameters: {''list[]'' : $$
(''input[name="list[]"]'').findAll(function(el) {
return
el.checked }).pluck(''value'') }
});
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
zuzmic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-17 11:54 UTC
Re: Checkbox array and Ajax.updater
Try this
new Ajax.Updater(''tpl'', url, { parameters:
{''list[]'' : $$
(''input[name="list[]"]'').findAll(function(el) {
return
el.checked }).pluck(''value'') } });
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Since the :checked pseudo-class is implemented in $$, you can say
$$(''input[name="list[]"]:checked'').pluck(''value'')
and save iterating
again with a findAll -- plus it''s much more readable :)
Best,
-Nicolas
On Dec 17, 2007 9:52 AM, zuzmic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
<zuzmic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Try this
> new Ajax.Updater(''tpl'', url, {
> parameters: {''list[]'' : $$
> (''input[name="list[]"]'').findAll(function(el) {
return
> el.checked }).pluck(''value'') }
> });
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
zuzmic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-18 11:45 UTC
Re: Checkbox array and Ajax.updater
Thanks Nicolás, yaeh , its look more sexy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---