From: Mark Hubbart Date: 2004-08-06T13:20:02+09:00 Subject: Re: [newbie] Auto-populating template forms? 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:
A
B
[snip] L
M
you have to map and join to produce the string, which gets passed to the enclosing functions. HTH, Mark