Last Updated: September 09, 2019
·
924
· jsmestad

Disabled input form elements do not get submitted

I ran into this the other day in a Rails 4 application we are taking over. This is more of a #protip so you don't bang your head against a wall.

Tip: Disabled <input> elements in a form will not be submitted.

via: http://www.w3schools.com/tags/att_input_disabled.asp


Also good to know that Rails' f.select or select_tag helper has an option disabled: ... where you can specify specific <option> items to disable. However when you have a boolean field as an option, you have to be careful as disabled: true will only disable the option with true as the value. Suggestion would be to use "0" or "1" as values to avoid this case.