I''m having a problem updating local variables. I was using some
date.select and time.select forms to save content to my database.
<%# f.label :StartTime %>
<%# f.time_select :start_time %>
<br />
<%# f.label :EndTime %>
<%# f.time_select :end_time %>
However, I would rather use calendardateselect
(http://code.google.com/p/calendardateselect/). I can access the value
returned from the user click on the calendar by this:
<%= calendar_date_select_tag "calendar",
Date.today,
:embedded => true,
:year_range => 1.years.ago..0.years.ago,
:time => true,
# this correctly calls the alert
#:onchange => "alert( ''End = '' +
$F(this ));"
:onchange => end_date_time = $F
%>
Using an :onchange to update the value of end_date_time. However, I
want to then do some string slicing on end_date_time to separate out the
date and times. I have tried to do this as part of the :onchange
action, but I have nil values:
:onchange => start_date_time = $F, end_date = end_date_time[1,4]}
My question is two fold; I want to update the local values for time and
date. Is this the best method? How would I go about doing it? Google
seems to be failing me, but I''m new to RoR so I may be searching for
the
wrong thing.
--
Posted via http://www.ruby-forum.com/.