I''ve got a div statement with id pets around a text box in my _form.rhtml file. For this textbox, I want to show or hide based on if the user has selected something from a pulldown list. I''ve got an observe_field that observes the collection_select and updates the div. I defined the action in my controller, and also created a rjs file for the action. The question I have is how do i check the value from the select so i can show/hide the div based on the value from the select. Thanks for any help, Jeff Cooper --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey, Imho no server is needed in this case, a simple javascript function would do hiding or showing a div depending on the value of some other control on the page. Cheers, Yuri On 5/10/07, Jeff <jscooper-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''ve got a div statement with id pets around a text box in my > _form.rhtml file. For this textbox, I want to show or hide based on > if the user has selected something from a pulldown list. I''ve got an > observe_field that observes the collection_select and updates the > div. I defined the action in my controller, and also created a rjs > file for the action. The question I have is how do i check the value > from the select so i can show/hide the div based on the value from the > select. > > Thanks for any help, > Jeff Cooper > > > > >-- Best regards, Yuri Leikind --~--~---------~--~----~------------~-------~--~----~ 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 Jeff, Jeff wrote:> I''ve got an observe_field that observes the collection_select > and updates the div. I defined the action in my controller, > and also created a rjs file for the action. The question I have > is how do i check the value from the select so i can show/hide > the div based on the value from the select.I''m not sure I''m understanding the current situation. You say you''ve "got an observe_field that observes the collection_select and updates the div" and then you ask "how do i check the value from the select so i can show/hide the div based on the value from the select". Maybe it''s just ''not enough caffine yet'', but those two statements don''t seem to correllate. To take a stab though, to send the value back from the observe_field, use :with => ''name_you_want_the_param_to_have''. The observe_field will automatically populate the named param with the value of the field being observed. Do not use the :update option if you''re going to use an RJS template. 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 -~----------~----~----~----~------~----~------~--~---