On 3 Dec 2008, at 19:07, Joe Peck wrote:

>
> Good afternoon to you all,
>
> I have an order form where people can check the fruits they want and
> select the price of each fruit that they have checked.
>
> When I click the checkbox now, it does not seem to affect the
> corresponding price dropdown.  What am I doing wrong?
>
> Here's the javascript:
> <script type="text/javascript">
> function toggle_fruit_price(lqname) {
>    $(lqname).disabled = (!$(lqname).disabled);
>  }
> </script>
>
> Then, inside my loop of @fruits:
> <%= fruit.name %>
> <%= check_box_tag fruit.name, 1, false, :onchange =>
> "toggle_fruit_price(#{fruit.name}_price);" %>
> <%= select_tag("#{fruit.name}_price", options_for_select((0..100))) %>
>
If you think of the javascript that will be generated it's just going  
to be

toggle_fruit_price(apple_price);

whereas you want it to be

toggle_fruit_price('apple_price');


Fred
> Does anyone see what I'm doing wrong?  Any help is appreciated.
> -- 
> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to