kazinix
kazinix

Reputation: 30103

Why does input with property disabled set to disabled is not submitted?

I have a form where some input elements' disabled property set to disabled. I noticed that with the presence of disabled=disabled, they are not submitted on the server. Why does it behave like that?

Upvotes: 0

Views: 364

Answers (2)

Alex
Alex

Reputation: 180

When set, the disabled attribute has the following effects on an element:

You should use readonly=readonly if you want their values submitted on the server.

Upvotes: 3

Quentin
Quentin

Reputation: 943220

Because that is what disabled is supposed to do. It effectively removes a control from the form while leaving a visible placeholder.

Perhaps you want readonly instead.

Upvotes: 2

Related Questions