Allow form validation on <output> element
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 3.2k
- PR merge metrics
- PR metrics pending
Description
The output element cannot have validation attributes:
https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element
It could be useful to allow constraint validation. Use case:
<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
<input type="number" id="a" name="a"> +
<input type="number" id="b" name="b"> =
<output name="result" for="a b"></output>
<p>Total cannot be higher than 100</p>
</form>
There is no declarative way to set constraint validation on individual input elements in this case. With constraint validation on the output, authors could set max="100" and use native form validation and css :invalid selectors.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the HTML Standard section linked in the issue, focusing on the output element and constraint validation. Define the required behavior for validation attributes, native form validation, and :invalid selectors; done means the standard clearly specifies and supports this use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100