Hello,
this is probably an easy question: I have a checkbox and a datetime
field in a form. This is what I want to achieve:
- in default mode the checkbox is unchecked and the datetime field is
hidden - when the user marks (clicks) the checkbox (so it is checked) the
datetime field is shown
This is what I have in my view (very close to it):
<% form_for(logentry, :url => @url, :method => @method) do |f| %>
<%= f.error_messages %>
<%= f.label :mycheckbox, "Remind me?" %> | <%= f.check_box :mycheckbox %> |
<%= f.label :remind_when, "Date"%> | <%= datetime_select "logentry","remind_when", :default => Time.now %> |
<%= f.submit submit_name %>
<% end %>Where should I sprinkle the javascript? Do I need to create another
action in my controller (show_element/hide_element) with rjs code? Or is
there something like onclick => “show element hideshow”?
Thanks
Patrick