-1

I've had this 'issue' today in our application and I fixed it by adding the field a second time to the view in a hidden field, which eventually did get posted, but this seems kinda sloppy ... and a workaround for something that should just work out of the box.

I keep on wondering though; why does it work like this? I'm sure this is implemented for a good reason .. anyone? Is there maybe some general web.config setting of some sort that does enable the posting of disabled fields for the entire application or for one particular form ( or entire page ) ?

This question is different than others as I want to know to know the reason why MVC works like this + if there is some sort of general setting to bypass this.

Regards.

Yannick
  • 91
  • 1
  • 6
  • You might want to consider readonly instead of disabled, but don't rely on the value that gets sent to the server. – Evan Mulawski Feb 11 '16 at 16:44
  • The HTML specification states that only [successful controls](https://www.w3.org/TR/html401/interact/forms.html#successful-controls) post their values. A disabled control is not a 'successful' control –  Feb 11 '16 at 21:18

1 Answers1

0

The browser determines what is posted, not MVC! Also, once you've become use to the convention it's fine.

Peter Smith
  • 5,528
  • 8
  • 51
  • 77