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.
D9e66bb7361fea87a658ceecb2f547d6?d=identicon&s=25 Mario T. Lanza (mlanza)
on 2007-05-22 18: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
588ab1c0a5610a7e160a3b101abb91e6?d=identicon&s=25 MichaelLatta (Guest)
on 2007-05-23 00: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
D9e66bb7361fea87a658ceecb2f547d6?d=identicon&s=25 Mario T. Lanza (mlanza)
on 2007-05-23 00: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.