Hi, I have a drop down select which fires an ajax call once selected. So when i select anything in the email_seperator drop down it fisre the ajax event below. <%= observe_field(''email_seperator'', :on => ''click'', :url => {:controller => ''possible_emails'', :action => ''update_email''}, :with => "''email_seperator=''+$F(''email_seperator'')", :before => "Element.show(''spinner'')", :success => "Element.hide(''spinner'')") %> What i want is when the page first loads for this ajax event to fire once so the correct information is diaplyed. Ive tried something like the below but it works for focus but not for click <%= javascript_tag render(:update) { |page| page[''email_seperator''].focus } %> <%= javascript_tag render(:update) { |page| page[''email_seperator''].click } %> Can anyone help?? JB -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi John, John Butler wrote:> > I have a drop down select which fires an ajax call once selected. > So when i select anything in the email_seperator drop down it fisre the > ajax event below. > > <%= observe_field(''email_seperator'', > :on => ''click'', > :url => {:controller => ''possible_emails'', :action => > ''update_email''}, > :with => "''email_seperator=''+$F(''email_seperator'')", > :before => "Element.show(''spinner'')", > :success => "Element.hide(''spinner'')") %> > > What i want is when the page first loads for this ajax event to fire > once so the correct information is diaplyed.What does ''so the correct information is displayed [sic]'' mean? If you mean you want to give the dropdown an initial value, options_for_select lets you specify the selected value. See the documentation for that method and the ones that follow it at api.rubyonrails.org. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Walton wrote:> Hi John, > > John Butler wrote: >> :before => "Element.show(''spinner'')", >> :success => "Element.hide(''spinner'')") %> >> >> What i want is when the page first loads for this ajax event to fire >> once so the correct information is diaplyed. > > What does ''so the correct information is displayed [sic]'' mean? If you > mean > you want to give the dropdown an initial value, options_for_select lets > you > specify the selected value. See the documentation for that method and > the > ones that follow it at api.rubyonrails.org. > > HTH, > BillYes i have the correct value displaying in the drop down but this then fires an ajax request when clicked to update some components on the view. Id like to automaticall fire this event when the page loads?? JB -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sat, Nov 29, 2008 at 2:34 AM, John Butler <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Yes i have the correct value displaying in the drop down but this then > fires an ajax request when clicked to update some components on the > view. Id like to automaticall fire this event when the page loads??That -- rendering a page and immediately changing it -- makes no sense at all; why are you not delivering your page with the proper initial state? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---