Is it acceptable for a submit button to have a name attribute?

扶醉桌前 提交于 2020-12-10 08:55:52

问题


Usually, a submit button works fine without a name attribute. However, there are occasions where there's a need to have two submit buttons for the same form, hence making use of the name attribute to identify which button was clicked on the server side.

To clarify I am talking about: <input type="submit" name="foo">


回答1:


Yes, it is entirely acceptable.

The specification has explicit rules for how to determine which submit button was successful, which would be useless if you couldn't give the element a name.



来源:https://stackoverflow.com/questions/16387519/is-it-acceptable-for-a-submit-button-to-have-a-name-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!