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

1

6

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">

Ironhanded answered 5/5, 2013 at 18:10 Comment(0)
C
9

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.

Covert answered 5/5, 2013 at 18:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.