Disabled form elements should not accept a new value
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
This is the case with Icinga\Web\Form and for good reason. Which is: A disabled element is not transferred by a browser. If no value is sent, the default is left unchanged and that is what is expected.
Under normal circumstances, while the element in the DOM is indeed disabled, this works fine already. While the user can manipulate the DOM, and enable the element, this isn't the main problem: If there's autosubmit functionality in the form, the disabled element might have been enabled prior submission. In this case the browser is transferring the value but if the submission results in a change of the form's elements, and the element in question is disabled, it accepts the previous value and overrides the default.
The only way to solve this at the moment, is to explicitly clear the populated value before registering the disabled element.
This should not be necessary and work by default the same as in Icinga\Web\Form.
I'm not saying disabled elements should never accept a new value. (Block or ignore calls to setValue()) But populated values must not be set.
Contributor guide
No contributing guide indexed for this repository
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 by comparing disabled-element handling in this library with the referenced Icinga\Web\Form behavior. Reproduce the autosubmit case where a previously populated value is submitted and the element becomes disabled; done means that populated value is not applied to the disabled element by default, while the issue's distinction around explicit setValue() remains respected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100