leora
leora

Reputation: 196459

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

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?

This makes no sense to me . ..

Upvotes: 2

Views: 2004

Answers (1)

Pekka
Pekka

Reputation: 449395

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.

Upvotes: 5

Related Questions