Uneditable text_field

<%= form.text_field :tags, :value => tags, :disabled=>“disabled” %>

disabled makes it uneditable, but when I submit my form, I suppose the
value of the input field becomes non-existant since it is disabled. What
workarounds are available?

Thanks

On Mon, Aug 11, 2008 at 10:48 AM, Justin To
[email protected] wrote:

<%= form.text_field :tags, :value => tags, :disabled=>“disabled” %>

disabled makes it uneditable, but when I submit my form, I suppose the
value of the input field becomes non-existant since it is disabled. What
workarounds are available?

The best “workaround” would be to learn HTML. Start by reading here:

http://www.w3.org/TR/html401/interact/forms.html#h-17.4

:: and specifically look at the “readonly” attribute :slight_smile:

FWIW,

Hassan S. ------------------------ [email protected]

I know html, but two issues:

  1. I don’t know how to add the readonly attribute into a text_field tag
  2. I read that readonly is not widely suppported

On Mon, Aug 11, 2008 at 11:32 AM, Justin To
[email protected] wrote:

I know html, but two issues:

  1. I don’t know how to add the readonly attribute into a text_field tag

Uh, wouldn’t it be just like the disabled attribute you already used?

  1. I read that readonly is not widely suppported

Read where? There’s a lot of outdated information out there.

In any case, easy enough to test on the most common browsers.

Besides, if it’s really a concern – why make it a form field at all?


Hassan S. ------------------------ [email protected]