I am revising someone else's project which allows users to submit content either for either immediate or scheduled publication. There are a pair of radio buttons to select this, and a datetime field that is enabled by javascript if the radio button for 'scheduled' is selected
<%= f.hidden_field :scheduled_state %>
<%= f.radio_button :immediate_or_scheduled, :immediate, :checked => "checked", :id => "pub_imd" %>
<%= f.radio_button :immediate_or_scheduled, :scheduled , :id => "pub_sch" %>
<label>Date/Time:</label>
<%= f.datetime_select :scheduled_start,
{:include_blank => false,
:default => 3.days.from_now,
:start_year => Time.now.year} %>
I'm not totally clear what the hidden field is for, that is my next point of investigation. Anyway, the problem is that when the form is submitted, sometimes the parameters just aren't submitted. I would copy the mongrel output, but all you see is that there is no :scheduled_start(1i) => 2010. It doesn't say that it is nil, it just does not have that parameter.
The thing that really gets me is that it is not a consistent issue - I can submit three times in a row with a scheduled date correctly and then it will fail. I have not been able to correlate with specific dates - some seem to mess up more than others but none are really consistent.
My attempted fixes-
Originally :include_blank got true, and I thought maybe it wasn't sending properly. Was irrelevant.
Tried turning off the javascript that disabled/enabled the select field, but was irrelevent.
Tried hardcoding the form in with pure html, made no difference.
Tried putting in custom rails select_tags for my own parameters, then pick them up in the controller and add them to the parameters. Still didn't help, and broke the immediate publication option.
I'm pretty solidly stumped, if anyone has a new direction I can examine that would be great. Thanks!