From: "Mark J. Reed" Date: 2003-07-15T11:43:28+09:00 Subject: Re: ruby-specific CGI question (I think) On Tue, Jul 15, 2003 at 11:10:55AM +0900, Kurt M. Dresner wrote: > cgi = CGI.new("html4") Okay, here's what's going on. When you create a CGI::Session, you pass it a CGI object. The session sets the @output_hidden instance variable within the CGI query object to so that elements get output at the end of every form. Except that, for some strange reason known only to the author of cgi.rb, it uses fieldsets: if @output_hidden hidden = @output_hidden.collect{|k,v| "" }.to_s if defined? fieldset body += fieldset{ hidden } else body += hidden end end The defined? test is just checking to see if fieldset is available - which it is if you ask for html4, but not if you ask for html3. I think this is clearly a bug in cgi.rb - there's no reason to put a fieldset around these elements just because you can. So your options are: 1. Modify your local copy of cgi.rb so that it doesn't do that. :) Great if you have permission to do that, otherwise no help. 2. Ask for html3 instead of html4. This is a bad idea for other reasons, though. You don't want to limit yourself to HTML 3, which is years out of date. 3. Create your own modified version of cgi.form within the script that munges the result. That last option goes something like this: def fix_form(cgi, *args, &block) return cgi.form(*args, &block).gsub(/<\/?fieldset[^>]*/i, '') end Then everywhere you currently have cgi.form { blah . . . } Just replace it with fix_form(cgi) { blah . . . } -Mark