Please help me - I’m out of ideas.
I want to create a form that passes various parameters to a Query
object. I sucessfully passed the parameter called machine_name BUT I
can’t pass the parameter called start_date.
The code for my form is shown below
<% form_for :query, :url => {:action => ‘show’} do |form| %>
<p>
<label for "query_machine_name"> Machine: </label>
<%= form.select :machine_name,
@machines,
:prompt => "Select Machine"
%>
</p>
<p>
<label for "query_start_date"> Start Date: </label>
<%=form.date_select(:start_date) %>
</p>
<%=submit_tag "Get Results", :class => "submit"%>
<%end%>
Again, machine name is PASSED OK.
I get no errors but the parameter start_date isn’t passed. I tried
substituting the date_select line for this:
<%=date_select(:query, :start_date) %>
this also did not trigger an error but did not pass start_date.
Ideally I would like a DateBocks calendar to pop up but I can’t figure
that out either. I get an error no matter what I put in - I have no idea
what to do with it. (I have installed the plugin.) I tried all of the
following (in place of the Date_Select line) and got the following
errors
<%=datebocks_field(:query, :start_date) %>
undefined method `+’ for :query:Symbol
<%=form.datebocks_field(:start_date) %>
undefined method `datebocks_field’ for
#ActionView::Helpers::FormBuilder:0x378bab0
<%=datebocks_field(@query[:start_date], :start_date) %>
undefined method `[]’ for #Query:0x3870930
<%=datebocks_field(:query[:start_date], :start_date) %>
undefined method `[]’ for :query:Symbol
<%=datebocks_field(@query.start_date, :start_date) %>
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.+
Please someone help -
(1) What am I doing wrong with Date_Select?
(2) What am I doing wrong with DateBocks and how do I associate it with
the form?
Any help much appreciated.
Karen