How to set a text_field to un-editable in ROR

hi all

pls can any one tell me how to set a text_field to un-editable in ROR.

i have to set a values for it and have to make it un-editable.

pls can some body help on this.

Thanks

add a ‘disabled’ => ‘true’, e.g.

<%= text_field ‘post’, ‘title’, ‘size’ => 30, ‘disabled’ => ‘true’ %>

On Dec 5, 4:20 am, Nadeesha M. <rails-mailing-l…@andreas-

On 05 Dec 2007, at 14:10, rubynuby wrote:

add a ‘disabled’ => ‘true’, e.g.

<%= text_field ‘post’, ‘title’, ‘size’ => 30, ‘disabled’ => ‘true’ %>

The XHTML definition clearly states it should be
disabled=“disabled” (http://www.w3schools.com/xhtml/xhtml_syntax.asp)
I also prefer the use of symbols for extra parameters.

<%= text_field “post”, “title”, :size => 30, :disabled => “disabled” %>

Best regards

Peter De Berdt

On Dec 5, 5:37 am, Peter De Berdt [email protected] wrote:

<%= text_field “post”, “title”, :size => 30, :disabled => “disabled” %>

Best regards

Peter De Berdt

thank you for the correction. I did use symbols in my code but
looking at the doc

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000506

it uses strings, so I changed it.

One of the more confusingg aspects of Ruby. sometimes it seems
strings and symbols are interchangeable, and sometimes they’re not.

If you pass :disabled => true, rails will properly spit out
disabled=“disabled”.

-Bill

William P. wrote:

If you pass :disabled => true, rails will properly spit out
disabled=“disabled”.

-Bill

Hi guys,

thanks a lot for the reply specially with the correct descriptions and
telling what the actual process happen in Ruby.

thanks
nadeesha

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs