HTML5 Validator: Bad value "" for attribute "action" on element "form": Must be non-empty
Question by Compi | 2016-02-21 at 18:44
I have turned my website into HTML 5 and at the moment, I am trying to validate it.
Among others, the HTML Validator is showing the following error.
Bad value "" for attribute "action" on element "form": Must be non-empty
How can I fix that? Apparently, the validator is moaning because I have left the "action" of my form empty.
However, I have done that even intentionally so that the script is always sending to the current page independent from the page you have called at the moment.
<form action="" method="post"> <input type="input" name="name"> <input type="submit" name="submit" value="Send"> </form>
The form is also working perfectly and also the HTML 4 Validator is not disturbed. What am I doing wrong here?
Related Topics
"G" or "E" sign on my mobile
Question | 1 Answer
HTML5 Validator: Element "link" is missing required attribute "property"
Question | 1 Answer
HTML5 Validator: How to fix "Warning trimming empty <p> or <div>"
Question | 1 Answer
HTML Validator Error "There is no Attribute XYZ"
Question | 1 Answer
English: "a user" or "an user"?
Question | 1 Answer
CSS: "align:center" and "align:right" not working
Question | 1 Answer
ImageResizer: Spelling Correction
Tip | 1 Comment
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You could just write action="#" instead of leaving it empty. This makes the attribute "action" non-empty so that the error message will no longer be displayed and at the same time, the script still remains independent from the page from which it was called.
This would switch your form to that:
If you only want to have the # within your HTML code, you can also try to remove it with JavaScript after parsing:
To ensure that the attribute is removed from the correct form, I have added the ID "myform" to your form, so that we can properly access it.
2016-02-21 at 19:54
You can also use PHP in order to always insert the current page as action-attribute.
For example like that:
Of course, if it is not necessary to make it dynamic and if you know the recipient page, the easiest way would be to just insert the recipient page behind "action" to get rid of this error.
2016-02-23 at 20:15