Still learning some stuff so forgive the newbie type questions. 1. if i use the :update param on form_for_remote can I mix javascript and ruby? i want to use the selector offered by prototype but pass in the parameters from a ruby expression <% form_remote_for(userdrug, :loading => "$(''XXXX'').show();" + "alert (''hi'');" do |f| %> I would basically like in where XXXX is to have an ruby expression like object.id 2. Can you use RJS commands for :loading ? seems like not :( 3. for the button: <%= f.submit "Update", :disable_with => "Please wait..." %> I would like it to be disabled until the request ir returned however using the above only disables it momentrily whil it is sending the request and then it can be pressed again even before the sever responds. Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
figured out answer to the first one: <% form_remote_for(userdrug, :loading => "$(''" + user.id + "'').show ();" + "alert(''hi'');" do |f| %> On Mar 25, 1:22 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Still learning some stuff so forgive the newbie type questions. > > 1. if i use the :update param on form_for_remote can I mix javascript > and ruby? i want to use the selector offered by prototype but pass in > the parameters from a ruby expression > > <% form_remote_for(userdrug, :loading => "$(''XXXX'').show();" + "alert > (''hi'');" do |f| %> > > I would basically like in where XXXX is to have an ruby expression > like object.id > > 2. Can you use RJS commands for :loading ? seems like not :( > > 3. for the button: > > <%= f.submit "Update", :disable_with => "Please wait..." %> > > I would like it to be disabled until the request ir returned however > using the above only disables it momentrily whil it is sending the > request and then it can be pressed again even before the sever > responds. > > Thanks!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 25, 5:22 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Still learning some stuff so forgive the newbie type questions. > > 1. if i use the :update param on form_for_remote can I mix javascript > and ruby? i want to use the selector offered by prototype but pass in > the parameters from a ruby expression > > <% form_remote_for(userdrug, :loading => "$(''XXXX'').show();" + "alert > (''hi'');" do |f| %> > > I would basically like in where XXXX is to have an ruby expression > like object.idThat''s a ruby string, you can put whatever ruby expression you want (of course this is evaluated when the template is rendered, not when you press submit> > 2. Can you use RJS commands for :loading ? seems like not :( >You can via update_page (an ajax responder is often cleaner though). You''ll write better JS once you get over RJS> 3. for the button: > > <%= f.submit "Update", :disable_with => "Please wait..." %> > > I would like it to be disabled until the request ir returned however > using the above only disables it momentrily whil it is sending the > request and then it can be pressed again even before the sever > responds. >Personally I would do that via an ajax callback. The code for submit looks it would undisable the button if the onsubmit returns false (which the one remote_form_for will do since it''s preventing the browser from submitting the form normally) Fred> Thanks!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Wed, Mar 25, 2009 at 12:22 PM, tashfeen.ekram <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 1. if i use the :update param on form_for_remote can I mix javascript > and ruby? i want to use the selector offered by prototype but pass in > the parameters from a ruby expressionYou can, but in some case you may find an RJS template easier to deal with, especially if you have complex logic after the form post. I usually just use :loading and :completed in my form tag and then do my update using replace_html instead of :update.> 2. Can you use RJS commands for :loading ? seems like not :(I''ve never tried, but yeah I think not also.> 3. for the button: > > <%= f.submit "Update", :disable_with => "Please wait..." %> > > I would like it to be disabled until the request ir returned however > using the above only disables it momentrily whil it is sending the > request and then it can be pressed again even before the sever > responds.That sounds like a bug to me. -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---