Opened 4 years ago

Closed 4 years ago

#31294 closed Bug (invalid)

Disabled (hidden) inputs don't transmit their data.

Reported by: berzi Owned by: nobody
Component: Forms Version: 3.0
Severity: Normal Keywords: forms, hidden, input, get, post
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by berzi)

It seems that hidden inputs (in my case I tried with a CharField and an EmailField, both with a HiddenInput as widget) "refuse" to transmit their data through the form if they are disabled.

It's possible that this happens with all disabled fields, and that it doesn't happen if the field has an initial value set on declaration, but initial values set at runtime get thrown away, and not all use-cases allow the initial value to be assigned on class declaration (for example, data from a request needs to be obtained at runtime).

The problem and a few test scenarios are outlined in this SO question.

Change History (2)

comment:1 by berzi, 4 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 4 years ago

Resolution: invalid
Status: newclosed
Summary: Disabled (hidden) inputs don't transmit their dataDisabled (hidden) inputs don't transmit their data.

This is not related with Django. disabled inputs elements aren't submitted with the form.

Note: See TracTickets for help on using tickets.
Back to Top