Submitting form elements with the same name

前端 未结 6 1120
自闭症患者
自闭症患者 2020-12-05 21:10

I have a form which allows the user to create extra \"rows\" using JQuery (using .clone) so that they can decide how many of the same information they need to submit. My iss

6条回答
  •  -上瘾入骨i
    2020-12-05 21:34

    You can change the id and name attribute of the input to something like this "Amount[1]","Amount[2]","Amount[3]" (yes, the id and name attribute can contain the special chars "[" or "]"). Then in the controller, write a http request parameter parser to get back the Amounts as collections.

提交回复
热议问题