Given a simple generic Rails form with a date_select (among other fields, I removed those in the code).
I’d love to add links to this form named Yesterday, Today, Tomorrow, … , Next Week. A click on one of these links should set the date_select to the correct date (no submit of the form).
What is the best way to accomplish this in Rails 3 without too much Javascript hassle?
<%= form_for(@entry) do |f| %>
<% if @entry.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@entry.errors.count, "error") %> prohibited this entry from being saved:</h2>
<ul>
<% @entry.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label "Datum" %><br />
<%= f.date_select :datum %>
</div>
....
View
entries.js.coffee.erb