Add more 'answers' at once


#1

I’m working on a questionnaire which is a “one to many”-realtion between
a question and some answers.

I can extract the data form the database whitout problems, but I’m
having problems creating a new question - or actually, creating new
answers to a question.

What I would like to have is: A form where you can write a question, and
then 8 (or whatever) text_fields where you can write some answers.
Adding one answer at the time wouldn’t be a problem (just like adding a
comment in the screencast on rubyonrails.com), but how do I add more
than one at the time?
What should the names of the text fileds be? How do i add them to the
database?

thanks in advance

Mike


#2

Haall wrote:

I’m working on a questionnaire which is a “one to many”-realtion between
a question and some answers.

I can extract the data form the database whitout problems, but I’m
having problems creating a new question - or actually, creating new
answers to a question.

What I would like to have is: A form where you can write a question, and
then 8 (or whatever) text_fields where you can write some answers.
Adding one answer at the time wouldn’t be a problem (just like adding a
comment in the screencast on rubyonrails.com), but how do I add more
than one at the time?
What should the names of the text fileds be? How do i add them to the
database?

thanks in advance

Mike

Page 356 of the Agile Web D. with Rails book might help you.
Chapter 17. It explains that if you put:

text_field(“answers[]”, …)

That you can build arrays of data. At least that may be a start for
you.

Jake