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
How to Replace multiple Texts at the same Time
Tutorial | 0 Comments
How to resize Image before Upload in Browser
Tutorial | 13 Comments
HTML5 Canvas: Beginner Tutorial Chapter 1 - Introduction and Basics
Tutorial | 0 Comments
Send HTML5 Canvas as Image to Server
Tutorial | 0 Comments
HTML: Preassign HTML Form with Data
Tutorial | 0 Comments
Send Form Input as an Array to PHP Script
Tip | 0 Comments
jQuery: Read and Change Data Attribute Value
Tutorial | 0 Comments
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