开发者

why does setting attribute "disabled" on a input text box stop that field from posting to the server when you submit a form?

开发者 https://www.devze.com 2023-01-15 12:40 出处:网络
if you set \"disabled\" on a input and submit a form, that field doesn\'t seem to be in the Request.Form when you post to the server.

if you set "disabled" on a input and submit a form, that field doesn't seem to be in the Request.Form when you post to the server.

What is the logic behind the design decision to not post this field solely based on some presentation layer decision?

T开发者_JAVA技巧his makes no sense to me . ..


Works as specified by the W3C (albeit a bit cryptical):

Disabled controls cannot be successful. [...]

A successful control is "valid" for submission

If you want to make an element unaccessible for the user, while sending along the value, use the readonly property.

0

精彩评论

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