Input attributes that can have the same “name”

前端 未结 7 714
野的像风
野的像风 2020-12-10 14:12

I noticed that if you have a couple of radios together, you are required to make the name attribute identical on all of them in order for the radios to work as expected:

7条回答
  •  醉话见心
    2020-12-10 14:54

    You can also have multiple hidden inputs of the same name. As pointed out it is a matter of how the server side framework will parse them. In .NET MVC the model binder will look for a collection of the same name in the parameter of the post action method or a property on the view model parameter of the post action. Such as List, List, or List

    See as an example: https://stackoverflow.com/a/2013915/84206

提交回复
热议问题