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

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.