# Adding custom behaviors to a text\_field?

**URL:** <https://www.ruby-forum.com/t/adding-custom-behaviors-to-a-text-field/99455>\
**Category:** Ruby\
**Created:** [July 22, 2006, 10:28pm UTC](https://www.ruby-forum.com/t/adding-custom-behaviors-to-a-text-field/99455 "2006-07-22T22:28:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 22, 2006, 10:28pm UTC](https://www.ruby-forum.com/t/adding-custom-behaviors-to-a-text-field/99455/1 "2006-07-22T22:28:10Z")

</div>

Hello, I’m sure most of you have seen the forms, where people fill the  
default value of a textbox with the field title, and then when you  
click it, it empties the field for data to be entered. As I am fairly  
new to ruby and rails, I am looking for an easy way to modify the  
default behavior of a text\_field, enabling it to create that effect.  
I’m wondering if i should write a new helper function all together to  
create this, or if there is simply a way to modify the existing  
text\_field behavior - as it will now have to handle displaying the  
title, or if a value exists - the value. (And of course, some sort of  
JS intervention will have to occur)

Thanks for your assistance!  
-Paul
