whatchamakeofit
2009-07-24 18:27:58 UTC
Hi. I have a textbox (not a textarea) that the user should fill out
with an integer value. On the processing page, it takes that value
and inserts it into the db. It's an optional field, and I don't want
to force the user to type in a 0 if the field isn't applicable. So, I
first tried using <cfparam name="form.numChildren" default="0">, but
when I try to output form.numChildren, it comes out as an empty
string, not zero. I've also tried <cfparam name="form.numChildren"
default="0" type="numeric">, but I end up getting the following error:
Invalid parameter type.
The value cannot be converted to a numeric because it is not a simple
value.Simple values are booleans, numbers, strings, and date-time
values.
The reason I want form.numChildren to come in as the integer 0 and not
the string "0" is because when I insert into the db, I don't see the
point in storing it as a string if it's simply a numeric value.
This seems like a very basic problem, but I can't seem to get it
working the way I want it to work. Please help! Thanks
with an integer value. On the processing page, it takes that value
and inserts it into the db. It's an optional field, and I don't want
to force the user to type in a 0 if the field isn't applicable. So, I
first tried using <cfparam name="form.numChildren" default="0">, but
when I try to output form.numChildren, it comes out as an empty
string, not zero. I've also tried <cfparam name="form.numChildren"
default="0" type="numeric">, but I end up getting the following error:
Invalid parameter type.
The value cannot be converted to a numeric because it is not a simple
value.Simple values are booleans, numbers, strings, and date-time
values.
The reason I want form.numChildren to come in as the integer 0 and not
the string "0" is because when I insert into the db, I don't see the
point in storing it as a string if it's simply a numeric value.
This seems like a very basic problem, but I can't seem to get it
working the way I want it to work. Please help! Thanks