Calendardateselect + observe_form?

=begin
I am using http://code.google.com/p/calendardateselect/ to make
date-selection easier.
This is my current code. I’d like the selection of a date to trigger the
observe_form and call the partial to be rendered.
My current attempt is to update a hidden field within the form when a
date is
selected, because plain date selection did not seem to work.
Did I just screw up the observe_form / form_remote_tag setup?
Is there a better option for date selection which will easily trigger
the observe_form?
=end

controllers/dictated_exams_controller.rb

class DictatedExamsController < ApplicationController

def index
@users = User.all
@from = Date.new
end

def filter_widget
text = “”
params.each { |a, b| text << "#{a} => #{b}
"}
render :text => text

end

end

views/dictated_exams/index.html

<% form_remote_tag :html => {:id => 'input', :action => url_for(:controller => "dictated_exams", :action => "filter_widget") } do || %> <%= collection_select :widget_user, :id, @users, :id, :name, { :prompt => true } %> <%= hidden_field 'date', '' %> <%= calendar_date_select_tag "calendar", Date.today, :time => false, :valid_date_check => "date < (new Date()).stripTime()", :onchange => "date.value = $F(this)" %> <% end %>

<%= observe_form :input,
# The field to observe
#:with => :id,
# The input to validate
:on => “onselect”,
#:frequency => 0,
# The frequency in seconds to watch for changes
:url => {:action => ‘filter_widget’, :controller => ‘dictated_exams’ },
# The action to call when changes occur
:update => :filter_counts
# Name of the

to update
%>
<%= render :text => "Results will be listed here." %>

Because it’s Javascript making a change, I need to make it refresh
regularly waiting for a change. On the bright side of things, if there
is no change, it does NOT trigger anything, which is nice.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs