# Not passing placeholder text

**URL:** <https://www.ruby-forum.com/t/not-passing-placeholder-text/108084>\
**Category:** Rails\
**Created:** [June 28, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/not-passing-placeholder-text/108084 "2007-06-28T22:22:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubylover](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rubylover](https://www.ruby-forum.com/u/rubylover)\
**Post date:** [June 28, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/not-passing-placeholder-text/108084/1 "2007-06-28T22:22:46Z")

</div>

I have several fields in a form that contain placeholder text prior to  
the user populating it with their own data. It’s just a mix of  
javascript onfocus/onblur tags to show/hide the placeholder text. I’m  
looking for suggestions on a DRY way of preventing the placeholder  
text from being saved to the database without having to check each  
field manually.

Any suggestions would be appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![rubylover](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rubylover](https://www.ruby-forum.com/u/rubylover)\
**Post date:** [July 2, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/not-passing-placeholder-text/108084/2 "2007-07-02T18:08:36Z")

</div>

Anyone?

- j

---

<div class="post-metadata">

**Author:** ![rubylover](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rubylover](https://www.ruby-forum.com/u/rubylover)\
**Post date:** [July 3, 2007, 3:50pm UTC](https://www.ruby-forum.com/t/not-passing-placeholder-text/108084/3 "2007-07-03T15:50:29Z")

</div>

Justin,

I think a Javascript helper method which attachs to the submit event of  
the  
form would be DRYest.  
It could even borrow some code from the functionality that shows/hides  
the  
placeholder text.

On 7/2/07, Justin W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > looking for suggestions on a DRY way of preventing the placeholder  
> > text from being saved to the database without having to check each  
> > field manually.
> > 
> > Any suggestions would be appreciated.
> > 
> > Thanks
> 
> >

–  
Manik J.  
company: [http://vinsol.com](http://vinsol.com)  
blog: [http://fromdelhi.com](http://fromdelhi.com)
