I've just run a webpage of mine through the W3C HTML5 validator, and it validates completely, even though the form in it doesn't have an action
attribute, which the HTML 4 validator alwa开发者_运维知识库ys complains about. Considering the fact that the HTML5 validator is still experimental, is the fact that the form validating despite not having an action
attribute a problem with the validator, or has the HTML5 spec changed to not require that attribute any more?
According to the specification action
is not mandatory:
The action and formaction content attributes, if specified, must have a value that is a valid non-empty URL potentially surrounded by spaces.
Although, section 4.10.1.3 Configuring a form to communicate with a server states that:
You also have to specify the URL of the service that will handle the submitted data, using the action attribute.
So, the specification says that if you want your form to communicate with a server it shall provide the action
attribute. Which, in my opinion, is not the only truth as you can specify action
s on buttons as well.
EDIT: I must admit that I can't finally answer your question with Yes or No...
精彩评论