# Uneditable text\_field

**URL:** <https://www.ruby-forum.com/t/uneditable-text-field/145582>\
**Category:** Rails\
**Created:** [August 11, 2008, 7:48pm UTC](https://www.ruby-forum.com/t/uneditable-text-field/145582 "2008-08-11T19:48:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [August 11, 2008, 7:48pm UTC](https://www.ruby-forum.com/t/uneditable-text-field/145582/1 "2008-08-11T19:48:43Z")

</div>

\<%= 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

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [August 11, 2008, 8:10pm UTC](https://www.ruby-forum.com/t/uneditable-text-field/145582/2 "2008-08-11T20:10:49Z")

</div>

On Mon, Aug 11, 2008 at 10:48 AM, Justin To  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://www.w3.org/TR/html401/interact/forms.html#h-17.4)

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

## FWIW,

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [August 11, 2008, 8:32pm UTC](https://www.ruby-forum.com/t/uneditable-text-field/145582/3 "2008-08-11T20:32:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [August 11, 2008, 9:20pm UTC](https://www.ruby-forum.com/t/uneditable-text-field/145582/4 "2008-08-11T21:20:00Z")

</div>

On Mon, Aug 11, 2008 at 11:32 AM, Justin To  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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. ------------------------ removed\_email\_address@domain.invalid
