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 always 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?
Yes, the form is required to have an action attribute in HTML4. If it's not set, the browser will likely use the same method as providing an empty string to it. You really should set action="" which is perfectly valid HTML4, follows standards, and achieves the same exact result.
The HTML | action Attribute is used to specify where the formdata is to be sent to the server after submission of the form. It can be used in the <form> element. Attribute Values: URL: It is used to specify the URL of the document where the data to be sent after the submission of the form.
The action attribute is used to specify where we want to send the form data when the form is submitted. So the value of the action is the page that will process the form.
The HTML form action attribute defines where to send the form data when a form is submitted in an HTML document.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With