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
, th开发者_StackOverflowey are not submitted on the server. Why does it behave like that?
When set, the disabled attribute has the following effects on an element:
Disabled controls do not receive focus.
Disabled controls are skipped in tabbing navigation.
Disabled controls cannot be successful.
(from http://www.w3.org/TR/html4/interact/forms.html#h-17.12)
You should use readonly=readonly if you want their values submitted on the server.
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.
精彩评论