开发者

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

开发者 https://www.devze.com 2023-03-26 09:33 出处:网络
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 i

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消