Thanks. I got it figured out. I had to use nested fields_for to get things to work correctly.

Although I'm having a problem now with getting popup menus to display the field value. I've checked in the view and the value is correct but the popup menu always says 0. The popup is the numbers from 0 to 10.

On Sep 25, 2007, at 10:41 AM, Peter Gumeson wrote:

Chris,

Can point you in the right direction... Have a look at FormHelper class.
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html

Although not very well documented in rails, you can add an :index =>
to each of your fields, which will allow you to create multiple
ProcessName objects directly from your form params.  Here's an
example:

http://railsforum.com/viewtopic.php?id=1065


On 9/24/07, Chris Griffin <[EMAIL PROTECTED]> wrote:
Well let me explain a little more. What I'm trying to do is allow the
user to name up to 10 records. The model has a name field along with
a bunch of other fields. So when they submit the form I would create
records for the fields they have filled in. So if they filled in 4
fields I would create 4 records. I created the following model just
for the form:

class ProcessName
   attr_accessor    :index, :name, :remove

   def initialize(params = {})
     @index = params[:index]
     @name = params[:name]
     @remove = params[:remove] || false
   end
end

I set up an array of 10 of that model inserting data for any records
that are in the DB and pass it to the view. The question is how to
represent that in the form in the view?

On Sep 24, 2007, at 1:07 PM, Peter Gumeson wrote:

Chris,

Need more info... possibly some code from your view(s) and controller.

Peter

On 9/24/07, Chris Griffin <[EMAIL PROTECTED]> wrote:
I'm trying to build a form that would let the user enter up to 10
names in 10 fields. There are also checkboxes next to each field for
deleting that field. I can't seem to figure out how to set up the
form so that the array get used properly in the form? Anyone have any
ideas?

Thanks,
Chris
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby



--
"A flute with no holes is not a flute,
and a doughnut with no hole is a Danish."

- Zen philosopher, Basho
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to