S
S
Sergey Korolkov2019-01-30 01:08:12
JavaScript
Sergey Korolkov, 2019-01-30 01:08:12

How to submit a form with the same name attribute?

My addField() function adds a new field, the same as in div="field", just duplicates it after it. Question! how do i send the form data to the c# asp.net server if the "name" attribute is the same in the newly created field. In addition, you can click on the "Add field" button several times. How to be here?

<form>
    <div class="field">
      <input name="Name" placeholder="Заголовок поля">
      <select name="select">
        <option value='textarea'>Один из списка</option>
        <option value='input'>Текст-строка</option>
      </select>
    </div>
    <input type="submit" value="Добавить поле" onclick="addField(this);">	
    <input type="submit" value="Сохранить">
  </form>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Somewhere Intech, 2019-01-30
@vhelsing90

Each input name="Name", because div is only responsible for the markup, it does not affect the send data. Well, at the reception ala or

string[] names = Request.QueryString.GetValues("Name");

S
Stalker_RED, 2019-01-30
@Stalker_RED

fKglD4.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question