Skip to content

Disabled form elements should not accept a new value #131

@nilmerg

Description

@nilmerg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions