hello, I am trying to display a Textarea if a user checks the checkbox and hides the textarea if the checkbox is not clicked. I can get the display working properly, however the actual checkbox is not actually checking. It is staying blank (not checked) no matter how many times I click it. Here is my code <%= check_box "event", "has_policy", "onclick" => "Effect.toggle(''policy''); return false;" %> <label class="choice" for="lbl3">Yes I want add a policy/terms agreement</label> <div id="policy" style="display:none;"> <div> <%= form.text_area :policy_a, :id=> ''field19'', :cols => 50, :rows => 10, :class => "medium" %> </div> </div> --~--~---------~--~----~------------~-------~--~----~ 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 9/13/07, bradigan <bradmadigan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > hello, I am trying to display a Textarea if a user checks the checkbox > and hides the textarea if the checkbox is not clicked. I can get the > display working properly, however the actual checkbox is not actually > checking. It is staying blank (not checked) no matter how many times I > click it. > Here is my code > > <%= check_box "event", "has_policy", "onclick" => > "Effect.toggle(''policy''); return false;" %> > <label class="choice" for="lbl3">Yes I want add a policy/terms > agreement</label>I''m guessing that "return false" is preventing the onclick from taking its default action, which is to check or uncheck the box. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> I''m guessing that "return false" is preventing the onclick from taking > its default action, which is to check or uncheck the box.I thought same thing. I tried that as well, but it broke the Toggle event. On Sep 13, 10:43 am, "Bob Showalter" <showa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9/13/07, bradigan <bradmadi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > hello, I am trying to display a Textarea if a user checks the checkbox > > and hides the textarea if the checkbox is not clicked. I can get the > > display working properly, however the actual checkbox is not actually > > checking. It is staying blank (not checked) no matter how many times I > > click it. > > Here is my code > > > <%= check_box "event", "has_policy", "onclick" => > > "Effect.toggle(''policy''); return false;" %> > > <label class="choice" for="lbl3">Yes I want add a policy/terms > > agreement</label> > > I''m guessing that "return false" is preventing the onclick from taking > its default action, which is to check or uncheck the box.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
So if you try ''return true;'' is it always checked? On 9/13/07, bradigan <bradmadigan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > I''m guessing that "return false" is preventing the onclick from taking > > its default action, which is to check or uncheck the box. > > I thought same thing. I tried that as well, but it broke the Toggle > event. > > > On Sep 13, 10:43 am, "Bob Showalter" <showa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On 9/13/07, bradigan <bradmadi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > hello, I am trying to display a Textarea if a user checks the checkbox > > > and hides the textarea if the checkbox is not clicked. I can get the > > > display working properly, however the actual checkbox is not actually > > > checking. It is staying blank (not checked) no matter how many times I > > > click it. > > > Here is my code > > > > > <%= check_box "event", "has_policy", "onclick" => > > > "Effect.toggle(''policy''); return false;" %> > > > <label class="choice" for="lbl3">Yes I want add a policy/terms > > > agreement</label> > > > > I''m guessing that "return false" is preventing the onclick from taking > > its default action, which is to check or uncheck the box. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---