form.datetime_select not working with IE in 1.1RC2 (but does with Firefox)
--------------------------------------------------------------------------
Key: JRUBY-2290
URL: http://jira.codehaus.org/browse/JRUBY-2290
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.1RC2
Reporter: John Woodward
Assignee: Thomas E Enebo
Took me a while to figure out I needed an account to enter a Jira. Duh .....
This is very peculiar ... I do most of my development with firefox as my
browser. Of course, our client uses IE, so every now and then, I run under IE
to make sure everything is consistent, still works, etc. Until recently,
everything was working out just fine, and all was rosey. Yesterday, I noticed
that parameters coming in from a form containing two date_time fields were
corrupt, but only under IE. With some debug code in place to print all the
incoming parameters, it's clear that not all the date_time parameters are being
passed back from the browser (or are not being mis-processed?), and some
parameters look like they're being stuffed into the params with a key that
shouldn't exist.
In trying to isolate the problem, I ended up creating a new project
(testproject) consisting of just one controller. The page has just very simple
controls. If I run this under webrick, and use IE, or use Tomcat + Firefox,
everything works fine. If I run under Tomcat, and use IE, I get incorrect
results. Here's all the code involved:
Say_controller.rb
class SayController < ApplicationController
def hello
outputParams
@search_params = SearchParams.new
end
def outputParms
puts "------------------------------"
for key in params.keys()
print key + " : "
print params[key]
print "\n"
end
puts "------------------------------"
end
end
Hello.erb
<html>
<head>
<title>Hello, Rails!</title>
</head>
<body>
<h1>Hello from Rails!</h1>
<% form_for :search_params do |form| %>
<table class="fmmAutoWeb">
<tr>
<td >Start date (UTC):</td>
<td ><%= form.datetime_select( :theStartDate ) %></td>
</tr>
<tr>
<td >End date (UTC):</td>
<td ><%= form.datetime_select( :theEndDate ) %></td>
<tr/>
</table>
<%= submit_tag "Submit", :name => "submit_button" %>
<%= submit_tag "Excel", :name => "submit_button" %>
<% end %>
</body>
</html>
Search_param.rb
class SearchParams
attr :theStartDate
attr :theEndDate
# Interestingly, if I want to overload "initialize", the new invocation
# only runs the last one defined. So, we should do it this way, with
# default values on the incoming set of parameters.
def initialize()
now = Time.now
@theStartDate = Time.utc( now.year, now.month, now.day, 7, 0, 0, 0 )
@theEndDate = Time.utc( now.year, now.month, now.day, 18, 0, 0, 0)
end
end
Application.rb
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
# protect_from_forgery # :secret => '2d7eddaca1b239d03c9478ba944bc67a'
self.allow_forgery_protection = false
end
Environments.rb turns off active_record via:
config.frameworks -= [ :active_record ]
What I end up getting when I run under IE + webrick or Firefox + Tomcat, is
what I expect:
--------------------------------
search_params :
theStartDate(1i)2008theStartDate(2i)3theStartDate(3i)14theStartDate(4i)07theStartDate(5i)00theEndDate(1i)2008theEndDate(2i)3theEndDate(3i)14theEndDate(4i)18theEndDate(5i)00
submit_button : Submit
controller : say
action : hello
--------------------------------
With IE + Tomcat, I get (after hitting "submit"):
--------------------------------
search_params : theStartDate(1i)2008
search_p : nil
controller : say
action : hello
--------------------------------
If I refresh the screen and tell repost the info, I get more complete data, but
still incomplete:
--------------------------------
search_params :
theStartDate(1i)2008theStartDate(2i)3theStartDate(3i)14theStartDate(4i)07theStartDate(5i)00theEndDate(1i)2008theEndDate(2i)3
controller : say
action : hello
--------------------------------
(note that search_params is missing the time component).
My environment is:
Ruby 1.8.6 (only used via Eclipse, running webrick)
jruby: "ruby 1.8.6 (2008-02-16 rev 5944) [x86-jruby1.1RC2]"
java: 1.6.0_04
tomcat: apache-tomcat-5.5.16
IE: Version: 6.0.2900.2180.xpsp_sp2_qfe.070227-2300CO
Firefox: 2.0.0.12
$ /c/buildtools/jruby-1.1RC2/bin/gem list --local
*** LOCAL GEMS ***
actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activeresource (2.0.2)
activesupport (2.0.2)
hoe (1.5.0)
rails (2.0.2)
rake (0.8.1)
rspec (1.1.3)
rubyforge (0.4.4)
sources (0.0.1)
warbler (0.9.3)
I built/packaged the war via "jruby warbler -S war", with all defaults for
warbler (i.e., I didn't even create a default warble.rb for this testproject)
I rolled back to 1.1RC1, and the problem is no longer there .... pointing to an
issue with 1.1RC2.
John
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email