# Form fields show 0 instead of blank, how to fix?

**URL:** <https://www.ruby-forum.com/t/form-fields-show-0-instead-of-blank-how-to-fix/99921>\
**Category:** Rails\
**Created:** [December 13, 2005, 9:00am UTC](https://www.ruby-forum.com/t/form-fields-show-0-instead-of-blank-how-to-fix/99921 "2005-12-13T09:00:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [December 13, 2005, 9:00am UTC](https://www.ruby-forum.com/t/form-fields-show-0-instead-of-blank-how-to-fix/99921/1 "2005-12-13T09:00:01Z")

</div>

I’ve got a scaffold generated form with a bunch of standard fields like  
name, phone number, address, plus some numeric ones like price, branch  
number, etc.

When the user first arrives at the form, I’d like the form to be totally  
blank. But right now, those numeric fields are all filled with zero’s.

What’s the correct way to solve this? Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [December 13, 2005, 2:58pm UTC](https://www.ruby-forum.com/t/form-fields-show-0-instead-of-blank-how-to-fix/99921/2 "2005-12-13T14:58:40Z")

</div>

Sean:

Not too sure what the CORRECT way is but assuming aesthetics is your  
concern, here are two possible solutions - one more amusing than the  
other.

1. Convert the number to a string (it will be anyway once the form  
has dealt with it (I believe) and then use an if to say if attribute  
whatever = “0” then attribute whatever = “”

2. Alternatively, if your form has a white background, you could  
use :class to have the text start as white and then change to black  
using :onfocus

bruce
