On Aug 4, 2004, at 4:11 PM, Mark Probert wrote:

>
> Hi, all.
>
> I have just started playing with Cerise and web apps, and I have run
> across a bit of a problem.  How do I populate a form, with array 
> values programatically?
>
> For example, how could I get a form with the letters A-M (as an array) 
> displayed as radio buttons?

I assume you are using the cgi module? You probably want something like 
this:

#....

   cgi.form("myForm") do
     values = ("A".."M")
     values.map do |value|
       cgi.radio_button(value) + cgi.strong{value} + cgi.br
     end.join
   end

#....


this gives:

<FORM METHOD="myForm" ENCTYPE="application/x-www-form-urlencoded">
   <INPUT NAME="A" TYPE="radio">
   <STRONG>
     A
   </STRONG>
   <BR>
   <INPUT NAME="B" TYPE="radio">
   <STRONG>
     B
   </STRONG>
   <BR>
[snip]
   <INPUT NAME="L" TYPE="radio">
   <STRONG>
     L
   </STRONG>
   <BR>
   <INPUT NAME="M" TYPE="radio">
   <STRONG>
     M
   </STRONG>
   <BR>
</FORM>


you have to map and join to produce the string, which gets passed to 
the enclosing functions.

HTH,
Mark