Is form action attribute allowed with empty value in HTML5 or XHTML5? I found contradicted two articles in Japanese, one says it is allowed, the other says not.

Allowed
This even says attributes themselves can be omitted.

Not Allowed
This information seems to be older than the other.

I tried to search the latest official information in English on W3C sites, but failed to find it.
Does anyone know how it is?

Thank you.

有帮助吗?

解决方案

The action attribute of the form element cannot have an empty value specified, the specifications are clear: http://www.w3.org/TR/html5/forms.html#attr-fs-action. Its value must be a valid URL, at least surrounded by white space characters.

However, it isn't mandatory: you can not define it, the from data will be sent to the same URL of the document.

I don't understand Japanese, so I can't tell you anything about the two articles you mentioned, sorry about that. Maybe one refers to an old draft of the specification.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top