hade
hade

Reputation: 1715

Rails fields_for ignores :disabled field

I'm using Rails 4.1.4 and have the basic structure for nested attributes using fields_for. I've noticed that disabled option is totally ignored for the fields inside the fields_for block.

In my code example the first text_field is disabled and the one after fields_for is not. What am I missing here?

   ...    
    <%= f.text_field :response_given, disabled: true %>
    <%= f.fields_for :meta_set do |mf| %>
      <%= mf.text_field :name, disabled: true %>
      ...

Upvotes: 2

Views: 894

Answers (1)

Oleg Antonyan
Oleg Antonyan

Reputation: 3113

Try readonly: true instead of disabled.

Upvotes: 3

Related Questions