Sandeep Gudibanda
2007-Nov-06 18:59 UTC
to Enable a disabled text_field onclick of radio button?
Hi, I have 3 radio buttons, with 1st checked. If the 3rd radio button is clicked, i want to enable the text_field. Anything wrong in the code below? It doesn''t work :( <%= radio_button :profile, :nick_name, "passport_style", :checked => "checked", :onclick => "$(''other_text'').disable();" %> <t> <%@profile.first_name + " " + @profile.last_name %> </t> <br/> <%= radio_button :profile, :nick_name, "school_style", :onclick => "$(''other_text'').disable();" %> <t> <%= @profile.first_name + " " + @profile.last_name[0..0] %> </t> <br/> <%= radio_button :profile, :nick_name, "user_own_style" , :onclick => "$(''other_text'').enable();" %> <span id="other_text"> <%= text_field ''user_choice'', ''user_choice'', :disabled => true %> </span> Regards, Sandeep G -- 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 -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-06 19:18 UTC
Re: to Enable a disabled text_field onclick of radio button?
The problem is that your text field is not called "other_text", your span is. You need to change your code to $(''user_choice'') and this should work. -Bill Sandeep Gudibanda wrote:> Hi, > > I have 3 radio buttons, with 1st checked. If the 3rd radio button is > clicked, i want to enable the text_field. > > Anything wrong in the code below? It doesn''t work :( > > > <%= radio_button :profile, :nick_name, "passport_style", :checked => > "checked", :onclick => "$(''other_text'').disable();" %> <t> <%> @profile.first_name + " " + @profile.last_name %> </t> <br/> > > <%= radio_button :profile, :nick_name, "school_style", :onclick => > "$(''other_text'').disable();" %> <t> <%= @profile.first_name + " " + > @profile.last_name[0..0] %> </t> <br/> > > <%= radio_button :profile, :nick_name, "user_own_style" , > :onclick => "$(''other_text'').enable();" %> > > > <span id="other_text"> <%= text_field ''user_choice'', ''user_choice'', > :disabled => true %> </span> > > Regards, > Sandeep G >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---