According to the documentation $(''ratingform'').request({ onComplete: function(){ alert(''Form data saved!''); ACRating.done(); } }); should work out of curiosity what AJAX is it producing? On 8/29/07, Onar Vikingstad <vikingstad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > According to this documentation I can do it the way I am trying to: > http://prototypejs.org/api/form/request > > Also, Prototype does produce some kind of AJAX request, but it is not > complete. > > I am assuming Prototype has modified the built in form object, which > is why I am using document.ratingform instead of $(''ratingform'') > (which I only can do if the form has an ID attribute). > > > Onar > > On Aug 28, 7:34 pm, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > er.... you might want to actually make an ajax request.... > > > > i.e. var something = new Ajax.Updater(''div_id'', ''page_url.ext'' > {options}); > > or > > var something = newAjax.Request(etc etc) > > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater > > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request > > > > On 8/28/07, Onar Vikingstad <vikings...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I have the following form that I would like to submit as an AJAX call: > > > > > <FORM ACTION="index" NAME="ratingform" METHOD="POST" > > > ENCTYPE="multipart/form-data" > > > > <INPUT type="hidden" name="action" value="TakeSurveyAction"/> > > > <INPUT type="hidden" name="success" value="content&id=HO1&act=RATE"/> > > > <INPUT type="hidden" name="error" value="content&id=HO1"/> > > > <INPUT type="hidden" name="surveyid" > > > value="0440173021ce8434011498b581210072c9" /> > > > <INPUT type="hidden" name="contentid" > > > value="0120790393af51c01142cddf5ac00760a" /> > > > > > <input type="radio" name="REQ~RADIO_BUTTON: > > > 0440173021ce8434011498b581210072cc" > > > value="1:0440173021ce8434011498b581210072c2" /> Not helpful > > > > > <input type="radio" name="REQ~RADIO_BUTTON: > > > 0440173021ce8434011498b581210072cc" > > > value="2:0440173021ce8434011498b581210072cb" /> Somewhat helpful > > > > > <input type="radio" name="REQ~RADIO_BUTTON: > > > 0440173021ce8434011498b581210072cc" > > > value="3:0440173021ce8434011498b581210072c8" /> Helpful > > > > > <input type="radio" name="REQ~RADIO_BUTTON: > > > 0440173021ce8434011498b581210072cc" > > > value="4:0440173021ce8434011498b581210072c4" /> Very helpful > > > > > <input type="radio" name="REQ~RADIO_BUTTON: > > > 0440173021ce8434011498b581210072cc" > > > value="5:0440173021ce8434011498b581210072c5" /> Solved my problem > > > > > </FORM> > > > > > (please don''t tear me down with the HTML above, I am not controlling > > > that :D ) > > > > > When I try using the following piece of JS, Firebug reports that > > > nothing was sent as post parameters (practically empty) and there is > > > no response. There are no Javascript errors presented: > > > > > document.ratingform.request({ > > > onComplete: function(){ alert(''Form data saved!''); > ACRating.done(); > > > } > > > }); > > > > > Any idea what is going on here? I am using Prototype 1.5.1. > > > > > Thanks, > > > Onar Vikingstad > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 Aug 29, 7:48 am, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> According to the documentation > > $(''ratingform'').request({ > onComplete: function(){ alert(''Form data saved!''); ACRating.done(); } > > }); > > should work > > out of curiosity what AJAX is it producing?This the complete request and response when using the code above: POST http://hidden.domain.com:8226/iapp/index HTTP/1.1 Host: hidden.domain.com:8226 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv: 1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 Paros/3.2.13 Accept: text/javascript, text/html, application/xml, text/xml, */* Accept-Language: en-us,en;q=0.5 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Proxy-Connection: keep-alive X-Requested-With: XMLHttpRequest X-Prototype-Version: 1.5.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Referer: http://hidden.domain.com:8226/iapp/index?page=content&id=HO1 Content-Length: 269 Pragma: no-cache Cache-Control: no-cache action=TakeSurveyAction&success=content%26id%3DHO1%26act %3DRATE&error=content%26id %3DHO1&surveyid=0440173021ce8434011498b581210072c9&contentid=0120790393af51c01142cddf5ac00760a&REQ~RADIO_BUTTON %3A0440173021ce8434011498b581210072cc=2%3A0440173021ce8434011498b581210072cb HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/html;charset=UTF-8 Content-Length: 0 Date: Wed, 29 Aug 2007 15:57:44 GMT Empty body. If I try to submit this form manually I get a 200 back as well but with content in the response body. --~--~---------~--~----~------------~-------~--~----~ 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 should add that if the form is submitted the "normal" way (not AJAX), this is the request sent: POST http://hidden.domain.com:8226/iapp/index HTTP/1.1 Host: hidden.domain.com:8226 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv: 1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 Paros/3.2.13 Accept: text/xml,application/xml,application/xhtml+xml,text/ html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Proxy-Connection: keep-alive Referer: http://hidden.domain.com:8226/iapp/index?page=content&id=HO1&act=RATE&newguid=040032129e62f50114ae5f2506007e10 Content-Type: multipart/form-data; boundary=---------------------------213545615918649556491785764778 Content-Length: 941 -----------------------------213545615918649556491785764778 Content-Disposition: form-data; name="action" TakeSurveyAction -----------------------------213545615918649556491785764778 Content-Disposition: form-data; name="success" content&id=HO1&act=RATE -----------------------------213545615918649556491785764778 Content-Disposition: form-data; name="error" content&id=HO1 -----------------------------213545615918649556491785764778 Content-Disposition: form-data; name="surveyid" 0440173021ce8434011498b581210072c9 -----------------------------213545615918649556491785764778 Content-Disposition: form-data; name="contentid" 0120790393af51c01142cddf5ac00760a -----------------------------213545615918649556491785764778 Content-Disposition: form-data; name="REQ~RADIO_BUTTON: 0440173021ce8434011498b581210072cc" 3:0440173021ce8434011498b581210072c8 -----------------------------213545615918649556491785764778-- Notice that the data is sent as multipart/form-data. I tried playing with the parameters by adding this: $(''ratingform'').request({ method: ''post'', contentType: ''multipart/form-data'', onComplete: function(){ alert(''Form data saved!''); ACRating.done(); } }); But it doesn''t make any difference. Any ideas? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
So, after a little searching, it looks like Ajax.Request doesn''t support multipart/form-data. I actually did a little searching and found this interesting ''patch'': http://dev.rubyonrails.org/ticket/4613 I will try subclassing the Ajax.Request object and see from there. Thanks for all help, Onar --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---