I have posted a couple of questions about the problem I am having submitting forms using Prototype 1.5.1.1''s Ajax Updater in the iPhone. The lack of replies I am taking to mean either: a) nobody else has seen this problem, or b) nothing is wrong with my example code. The fact that it isn''t working would lead me to believe that: c) I haven''t explained the problem clearly enough, might be another possible reason, too. I have narrowed this down through trial and error to the output of serialize() (or lack thereof). When I post the form through Ajax.Updater, I am including the form using {parameters: $(''the_form_id'').serialize, evalScripts: true} This works on all the regular desktop browsers, but it results in an empty POST at the server when submitted from iPhone. The POST works, but it''s empty. The JavaScript I am using does not error in FireBug, nor does it error in the iPhone''s new JavaScript console. Nevertheless, the post is completely empty. Can anyone here see what might be wrong with the following example? <script type="text/javascript" charset="utf-8"> $(''registered_reply'').observe(''submit'',function(evt){ Event.stop(evt); $(''registered_reply'').onsubmit = function(){ return false; }; new Ajax.Updater(''reply_form'',''form.php'',{parameters: $ (''registered_reply'').serialize(),evalScripts:true}); }); </script> Thanks in advance, Walter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This may not help at all but i''ve always used postBody when wanting to post, rather than parameters. This is on the desktop anyway... I did read somewhere that if postBody is empty, it''s copied to parameters but might be worth a shot. I think the number of people developing for iPhone with prototype is probably the reason due to the lack of replies. Gareth On 10/1/07, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> > > I have posted a couple of questions about the problem I am having > submitting forms using Prototype 1.5.1.1''s Ajax Updater in the iPhone. > > The lack of replies I am taking to mean either: a) nobody else has > seen this problem, or b) nothing is wrong with my example code. The > fact that it isn''t working would lead me to believe that: c) I > haven''t explained the problem clearly enough, might be another > possible reason, too. > > I have narrowed this down through trial and error to the output of > serialize() (or lack thereof). > > When I post the form through Ajax.Updater, I am including the form using > > {parameters: $(''the_form_id'').serialize, evalScripts: true} > > This works on all the regular desktop browsers, but it results in an > empty POST at the server when submitted from iPhone. The POST works, > but it''s empty. The JavaScript I am using does not error in FireBug, > nor does it error in the iPhone''s new JavaScript console. > > Nevertheless, the post is completely empty. > > Can anyone here see what might be wrong with the following example? > > <script type="text/javascript" charset="utf-8"> > $(''registered_reply'').observe(''submit'',function(evt){ > Event.stop(evt); > $(''registered_reply'').onsubmit = function(){ return false; > }; > new Ajax.Updater(''reply_form'',''form.php'',{parameters: $ > (''registered_reply'').serialize(),evalScripts:true}); > }); > </script> > > Thanks in advance, > > Walter > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
A quick read through the source of 1.6 gave me the answer. Apparently there is something hinky about the extension of the Form object in Mobile Safari. In the first block (Browser:) I added this line at the end of the array: MobileSafari: !!navigator.userAgent.match(/iPhone.*Mobile.*Safari/) And then right before var Class... I added this: if (Prototype.Browser.MobileSafari) Prototype.BrowserFeatures.SpecificElementExtensions = false; And presto! It all just works. I have no idea why, and would appreciate a word from one of the weezards on this list about what this means exactly. Thanks, Walter On Sep 30, 2007, at 3:55 PM, Gareth Evans wrote:> I think the number of people developing for iPhone with prototype > is probably the reason due to the lack of replies. >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---