E
E
eldar_web2015-05-14 11:36:58
Ruby on Rails
eldar_web, 2015-05-14 11:36:58

How to handle multiple inputs with the same name in Rails?

Let's say there are two inputs in the form with the same name:

<input type='text' name='adress' />
<input type='text' name='adress' />

And how in the controller to accept all the values ​​\u200b\u200bof these inputs or how to write it down correctly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2015-05-14
@eldar_web

// EDIT: indexes are optional.

<input type='text' name='adress[]' />
<input type='text' name='adress[]' />
...
<input type='text' name='adress[]' />

M
Maxim Grechushnikov, 2015-05-14
@maxyc_webber

just like in other programming languages ​​- no way!

A
Arthur Gurinovich, 2015-05-14
@ArthurGurinovich

As an option try xPath: /html/body/input[2]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question