Opened 7 months ago

Closed 7 months 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 Changed 7 months ago by berzi

Description: modified (diff)

comment:2 Changed 7 months ago by felixxm

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