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
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.
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 = “”
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.