Submitting form elements with the same name

前端 未结 6 1125
自闭症患者
自闭症患者 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条回答
  •  眼角桃花
    2020-12-05 21:44

    I believe if you have multiple fields named Amount the values will be comma delimited.

    To access each one just try:

    string[] amounts = Request.Form["Amount"].Split(new char[] { ',' });
    

    Keep in mind though, the inputs are not cleaned on submission so if someone enters a comma into the text box it's going to cause issues.

    Hence I'd recommend numbering them.

提交回复
热议问题