Take the 2-minute tour ×

I have a edit form in Active Admin. I need some field as read only.

My current edit page is like

enter image description here

I need the page look like this

enter image description here

How can this be done. My code for the edit form page is like

    form :html => { :enctype => "multipart/form-data" } do |f|  
      f.inputs "Users" do
        f.input :device, :label => 'Device', :as => :select, :collection => DEVICE, :include_blank => false
        f.input :current_address, :label => 'Current Address', :as => :string

Please help.

share|improve this question
any progress in this issue? –  Fivell Oct 15 '12 at 10:02
actually what i did is I added disabled => true, I see the disabled text box. I styled the background of the text box to match the page color. So it looks like what I need. but that's not the correct way :( –  Amal Kumar S Oct 15 '12 at 15:51
It's a pity, it could be good option –  Fivell Oct 16 '12 at 13:23
add comment

2 Answers

Try to add , :disabled => true for address input field.

share|improve this answer
when I add :disabled => ture I can see the textbox there, and it wont be editable. Actually I dont wan't any textbox there. –  Amal Kumar S Oct 3 '12 at 9:52
add comment

As Alex said, set to disabled. You could then use css to get the visual you wanted, if you can live with the semantics of that.

The syntax was slightly different for me to get this to work.

in your admin form:

 f.input :finish_position, :input_html => { :disabled => true } 

in your CSS active_admin.css

  background-color: #F4F4F4;
  border: 0px solid #F4F4F4 !important;  
share|improve this answer
add comment

Your Answer


