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


#1

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 :slight_smile:


#2

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