Closed ghost closed 12 years ago
i have done it like this with datepicker - guessing it would be the same with datetimepicker? your coffeescript would look something like this
# date picker selected callback
onSelectMethod = (dateText, inst) ->
$("#to").datetimepicker "option", "minDate", dateText
# bind to date picker
$('#to').datetimepicker('option', 'onSelect', onSelectMethod)
Thanks for your response but I solved my problem. I wasn't thinking about it correctly, I was wondering if you could pass the onSelect on the line:
<%= f.datetime_picker :to, maxDate: "0", changeMonth: "true", changeYear: "true" %>
But all you need to do is give it an id like so:
<%= f.datetime_picker :to, id: "myToDatePicker" %>
Then in coffescript/javascript you can reference it as so:
$("#myToDatePicker").datetimepicker
I can see how to pass options, but how can I add a onSelect function?
What I would like to add:
Add to the line:
<%= f.datetime_picker :to, maxDate: "0", changeMonth: "true", changeYear: "true" %>