I have a button option in my form with 2 options. User may only select one of the options. Based on the option they choose I want an associated select list to appear. I''m guessing this can only be done with javascript or can it be done with just Ruby ? TIA Stuart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
In case this wasn''t clear I wanted to elaborate a little more. The user would choose from either an "annual" or "hourly" option. Based on that there would be a list listing dollar amounts. When I first built the amounts table there was a secondary id column , where id-1 was annual and id-2 was hourly. Anyway, I guess this is a javascript thing but then would the whole template need to be a rjs ? Also if there are any pure Ruby options to accomplish this , that would be better. TIA Stuart On 9/6/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a button option in my form with 2 options. User may only select > one of the options. Based on the option they choose I want an > associated select list to appear. I''m guessing this can only be done > with javascript or can it be done with just Ruby ? > > TIA > Stuart >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Why not use Ajax? You could use form_remote_tag to make the annual and hourly buttons into forms (independent of your main form) (iirc you can''t nest forms). You could then wrap the dollar-amount-selector (and a hidden annual-or-hourly text field, if needed) in a div and have the contents of that div replaced by the server whenever the annual or hourly buttons were clicked. (Yes it is all javascript behind the scenes, but javascript which has already been written.) Hope it helps, Regards Chris. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9/6/06, Chris Dew <cmsdew-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Why not use Ajax? You could use form_remote_tag to make the annual and > hourly buttons into forms (independent of your main form) (iirc you > can''t nest forms).I don''t believe there is a reason couldn''t nest forms.> > You could then wrap the dollar-amount-selector (and a hidden > annual-or-hourly text field, if needed) in a div and have the contents > of that div replaced by the server whenever the annual or hourly > buttons were clicked. >This would still show up within the main form ? And do I move everything to a RJS template ? Stuart> Chris. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---