# Uneditable text input field

**URL:** <https://www.ruby-forum.com/t/uneditable-text-input-field/187604>\
**Category:** Rails\
**Created:** [April 26, 2010, 7:15pm UTC](https://www.ruby-forum.com/t/uneditable-text-input-field/187604 "2010-04-26T19:15:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 26, 2010, 7:15pm UTC](https://www.ruby-forum.com/t/uneditable-text-input-field/187604/1 "2010-04-26T19:15:00Z")

</div>

Does anyone know if it is possible to create an uneditable text input  
field using the form tag helpers?

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 26, 2010, 7:20pm UTC](https://www.ruby-forum.com/t/uneditable-text-input-field/187604/2 "2010-04-26T19:20:16Z")

</div>

On Apr 26, 6:13 pm, ES [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Does anyone know if it is possible to create an uneditable text input  
> field using the form tag helpers?

You should be able to set the disabled or readonly attribute (these  
aren’t the same - make sure you use the one most appropriate for your  
usage)

Fred

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 26, 2010, 7:27pm UTC](https://www.ruby-forum.com/t/uneditable-text-input-field/187604/3 "2010-04-26T19:27:18Z")

</div>

nice, thanks!

On Apr 26, 7:18 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 26, 2010, 10:47pm UTC](https://www.ruby-forum.com/t/uneditable-text-input-field/187604/4 "2010-04-26T22:47:46Z")

</div>

Frederick C. wrote:

> On Apr 26, 6:13ï¿½pm, ES [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Does anyone know if it is possible to create an uneditable text input  
> > field using the form tag helpers?
> 
> You should be able to set the disabled or readonly attribute (these  
> aren’t the same - make sure you use the one most appropriate for your  
> usage)

But this is usually poor UI design. In general, it’s better to either  
leave the control enabled or use static text.

And of course, don’t rely on a disabled control to prevent users from  
changing things. A malicious user could send a specially crafted  
request to your application that would edit a “disabled” parameter…

> Fred

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
