Rails form_tag does not send params if disabled: true

Yes, that is the expected behavior. It is probably not mentioned in the Rails documentation because the disabled and readonly control behavior is defined by the W3C spec.

See the W3C documentation for Disabled controls, which states “disabled controls cannot be successful”. A “successful” control is defined as being “‘valid’ for submission.” Setting disabled to true on an input field in Rails will not cause it to not be submitted.

Read-only controls, however, can be successful. Therefore, if you wanted the value to be submitted, but not editable, you should use readonly set to true.

Leave a Comment

tech