Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled form elements should not accept a new value #131

Open
nilmerg opened this issue Jan 16, 2024 · 0 comments
Open

Disabled form elements should not accept a new value #131

nilmerg opened this issue Jan 16, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nilmerg
Copy link
Member

nilmerg commented Jan 16, 2024

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.

@nilmerg nilmerg added the enhancement New feature or request label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant