From: why the lucky stiff Date: 2004-12-22T07:54:23+09:00 Subject: Re: html form generation problems Dennis Roberts wrote: > I think I must be doing something wrong. I am attempting to generate > a form which values from existing data. Here is a simplified version > of what I am trying to do (see below). I don't get a form element > with this, I get something like: > > I also notice the HEAD and TITLE tags are missing. Any advice? You'll need to concatenate the various strings together to get this to work. You might also consider using instance_eval to simplify things. #!/usr/bin/ruby -w require 'cgi' cgi = CGI.new("html3") ary = %w( one two three ) cgi.instance_eval do out do html do head do title { "Form Test" } end + body do form do ary.collect do |value| text_field value, value end.join + submit end end end end end _why