Hi,

I am trying to figure out the syntax to enable text field based on
checkbox selection. Your help is greatly appreciated.

What is wrong with the following definition?

<% form_for(@contact) do |f| %>
...
  <p>
    <%= f.label :can_call %><br />
    <%= f.check_box :can_call, :onclick => "$
('contact_phonenumber').disabled = $
('contact_can_call').checked;", :onchange => "$
('contact_phonenumber').disabled = $('contact_can_call').checked;" %>
  </p>
  <p>
    <%= f.label :phonenumber %><br />
    <%= f.text_field :phonenumber, :size => 80, :maxlength =>
20, :disabled => "$('contact_can_call').checked?false:true;" %>
  </p>
  ...
<% end %>

Thanks,

Josh

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to