Forum: Ruby on Rails Collecting data from many instance of same field

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mario T. L. (Guest)
on 2007-05-22 20:52
How do I format a view to handle multiple instances of the same field.
For example, I want to send an email to several recipients.  I list the
same field 5 times:

<p><label>Email:</label> <%= text_field 'invitation', 'recipient_email',
:onkeyup => 'verifyInput()' %></p>
<p><label>Email:</label> <%= text_field 'invitation', 'recipient_email',
:onkeyup => 'verifyInput()' %></p>
<p><label>Email:</label> <%= text_field 'invitation', 'recipient_email',
:onkeyup => 'verifyInput()' %></p>
<p><label>Email:</label> <%= text_field 'invitation', 'recipient_email',
:onkeyup => 'verifyInput()' %></p>
<p><label>Email:</label> <%= text_field 'invitation', 'recipient_email',
:onkeyup => 'verifyInput()' %></p>

I can't seem to collect the various instances of the input within the
controller.  I have also tried the text_field_tag.

Would greatly appreciate any help.  Thanks.
Mario
MichaelLatta (Guest)
on 2007-05-23 02:30
(Received via mailing list)
You need to give each one unique names like invitation1, invitation2,
etc.  Then you can place them in a separate table or whatever you want
to do with them.

Michael
Mario T. L. (Guest)
on 2007-05-23 02:36
> You need to give each one unique names like invitation1, invitation2, etc.

Thanks...

I realized this possibility, however, I was looking to treat them as an
array.  Does Rails handle converting multiple like-named inputs to an
array?
This topic is locked and can not be replied to.