#26129 closed Bug (fixed)
bound forms do not display disabled field initial values
Reported by: | Gerald Thibault | Owned by: | Tim Graham |
---|---|---|---|
Component: | Forms | Version: | 1.9 |
Severity: | Release blocker | Keywords: | disabled fields, forms |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | |||
Description ¶
The subject pretty much says it all. If you create a form with an initial value for a disabled field, it displays fine as long as the form is unbound. If a user submits the form, and it fails validation, the rendered bound form will be missing the initial values for the disabled fields.
I would expect the disabled fields to always display the contents from the form's "initial" dict, whether bound or unbound. The user is unable to submit values for that field, and even if he/she tampered with the DOM and managed to push something through, _clean_fields still loads the initial value and then assigns it to cleaned_data. So the handling is correct, but that value never ends up in the rendered field. 'initial' is the only possible source for that field, so it seems it should display all the time.
I attached a test file that illustrates the issue.
Change History (7)
by , 9 years ago
Attachment: | disabled.py added |
---|
comment:1 by , 9 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
Seems to be an important bug in a new feature in 1.9 (#25078). Possible test attached -- may need to be adjusted depending on the actual solution.
by , 9 years ago
Attachment: | 26129-test.diff added |
---|
comment:2 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
An example of a disabled field displaying the value in an unbound form, but omitting the value in a bound form.