I currently have a form which submits using Ajax.Request, a php file processes the form info then upon completion of the function, I use Ajax.Updater to reload the div content which contains my updated list of users. My only issue is how do I get the form to reset after the Ajax.Request and Ajax.Updater completes. I am still learning and trying to read through all things Prototype to learn how to do this correctly. However, I''ve been unable to figure it out. I''ve tried Form.reset(''formName'') in it''s own JS function and trying to run after my Ajax.Updater completes, but it is not working. Here is my script: <script type="text/javascript"> //For the initial load of the page new Ajax.Updater(''current_users'', ''users_current.php'', { method: ''get'' }); function ajaxRequest(url,data) { var aj = new Ajax.Request( url, { method:''post'', parameters: data, onComplete: reloadUsers } ); } function reloadUsers() { new Ajax.Updater(''current_users'', ''users_current.php'', { method: ''get''}); } </script> I know I might be doing this wrong, but I am into day 3 of learning this so I am open to any tips and reprimands! Thanks in advance, Jen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maybe try replacing the form or just that element using another chained Ajax Updater. Walter On Jul 9, 2007, at 8:17 AM, jenner wrote:> > My only issue is how do I get the form to reset after the Ajax.Request > and Ajax.Updater completes. I am still learning and trying to read > through all things Prototype to learn how to do this correctly. > However, I''ve been unable to figure it out. I''ve tried > Form.reset(''formName'') in it''s own JS function and trying to run after > my Ajax.Updater completes, but it is not working.--~--~---------~--~----~------------~-------~--~----~ 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 Jul 9, 2007, at 6:17 AM, jenner wrote:> I''ve tried > Form.reset(''formName'') in it''s own JS function and trying to run after > my Ajax.Updater completes, but it is not working.That''s because the reset() function is native to the form object, not a Prototype add on. $(''formId'').reset() works just fine for me. TAG --~--~---------~--~----~------------~-------~--~----~ 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 Jul 10, 4:45 am, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote:> On Jul 9, 2007, at 6:17 AM, jenner wrote: > > > I''ve tried > > Form.reset(''formName'') in it''s own JS function and trying to run after > > my Ajax.Updater completes, but it is not working.To use Form.reset() you should use an ID, not a name. If you want to use the form name, use: document.forms[''formName''].reset();> That''s because the reset() function is native to the form object, not > a Prototype add on. > > $(''formId'').reset() works just fine for me.Actually, it''s both native and a Prototype.js add-on. About line 2618 in v1.5.1: var Form = { reset: function(form) { $(form).reset(); return form; }, -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brilliant, thanks for the tip. $(''formId'').reset() worked perfectly. Still working out the kinks, but this so far, I am really enjoying working with it. Thanks to everyone else for their responses too. I am sure I will be reading through tons of posts here in the coming days. On Jul 9, 2:45 pm, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote:> On Jul 9, 2007, at 6:17 AM, jenner wrote: > > > I''ve tried > > Form.reset(''formName'') in it''s own JS function and trying to run after > > my Ajax.Updater completes, but it is not working. > > That''s because the reset() function is native to the form object, not > a Prototype add on. > > $(''formId'').reset() works just fine for me. > > TAG--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---