Hello I have given myself a headache! I would like to use Form.serialize to get data from some forms and combine this with data obtained from elsewhere and then use Ajax.Updater but do not know how to do this ... I have code below - how do I use Form.serialize to get the checkbox result into Ajax.Updater? In other words what goes into the ??:?? ........ Cheers Geoff function send(){ var params ({groupnumber:group_number,emailaddress:email_address,cue1clicked:cue1_clicked,??:??}); new Ajax.Updater( ''updateDiv'', ''send.php'', { asynchronous:true, method:''get'', parameters: params } ); } <form name="form1"> Nowhere in particular <input type="checkbox" id="cb1"> </form> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Geoff, Form.serialize() (with the "true" parameter) returns a hash; you just add things to the hash before passing it on to the Ajax.Updater. Give the form an ID (rather than a name) so you can retrieve it with $ (), and give the form fields names (rather than or in addition to IDs; form fields work with names, since the name can be repeated on the page). Then this code in place of your current params stuff should do the trick: * * * * var params; params = $(''form1'').serialize(true); params.groupnumber = group_number; params.emailaddress = email_address; params.cue1clicked = cue1_clicked; * * * * Hope this helps, -- T.J. Crowder tj / crowder software / com On Mar 28, 5:49 pm, geoffcox <geoffa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello > > I have given myself a headache! I would like to use Form.serialize to > get data from some forms and combine this with data obtained from > elsewhere and then use Ajax.Updater but do not know how to do this ... > > I have code below - how do I use Form.serialize to get the checkbox > result into Ajax.Updater? In other words what goes into > the ??:?? ........ > > Cheers > > Geoff > > function send(){ > var params > ({groupnumber:group_number,emailaddress:email_address,cue1clicked:cue1_clicked,??:??}); > new Ajax.Updater( > ''updateDiv'', > ''send.php'', > { > asynchronous:true, > method:''get'', > parameters: params > } > ); > > } > > <form name="form1"> > Nowhere in particular <input type="checkbox" id="cb1"> > </form>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mar 29, 1:57 pm, "T.J. Crowder" <tjcrow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Geoff, > > Form.serialize() (with the "true" parameter) returns a hash; you just > add things to the hash before passing it on to the Ajax.Updater. > > Give the form an ID (rather than a name) so you can retrieve it with $ > (), and give the form fields names (rather than or in addition to IDs; > form fields work with names, since the name can be repeated on the > page). Then this code in place of your current params stuff should do > the trick: > > * * * * > var params; > params = $(''form1'').serialize(true); > params.groupnumber = group_number; > params.emailaddress = email_address; > params.cue1clicked = cue1_clicked; > * * * * > > Hope this helps,Excellent! Much better than the workaround I came up with using a function! Thanks Geoff> -- > T.J. Crowder > tj / crowder software / com > > On Mar 28, 5:49 pm, geoffcox <geoffa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello > > > I have given myself a headache! I would like to use Form.serialize to > > get data from some forms and combine this with data obtained from > > elsewhere and then use Ajax.Updater but do not know how to do this ... > > > I have code below - how do I use Form.serialize to get the checkbox > > result into Ajax.Updater? In other words what goes into > > the ??:?? ........ > > > Cheers > > > Geoff > > > function send(){ > > var params > > ({groupnumber:group_number,emailaddress:email_address,cue1clicked:cue1_clicked,??:??}); > > new Ajax.Updater( > > ''updateDiv'', > > ''send.php'', > > { > > asynchronous:true, > > method:''get'', > > parameters: params > > } > > ); > > > } > > > <form name="form1"> > > Nowhere in particular <input type="checkbox" id="cb1"> > > </form>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---