Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top