Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

empty or null default value for a numeric variable

Status
Not open for further replies.

pitz77

Programmer
Apr 27, 2004
14
US
Hi,

I would like to default a numeric variable to empty. The situation is that I've got a page that takes FORM/URL scope variables from the previous page and from a post back of itself. Here's some code:

<cfparam name="fooPostBackVar" type="numeric" default=??>
<cfparam name="fooLocalVar" type="numeric" default=#fooPostBack#>

<input type="text" value="#fooLocalVar#">


The first time the user comes to the page, I'd like fooLocalVar to be null yet still retain the datatype in case of a postback.

The question: what to I put in place of default=??.
 
i think you can actually remove it altogether, default= is an optional attribute.


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
Nope. I did that and I get this error because I use "fooPostBackVar" to define "fooLocalVar".


The required parameter fooPostBackVar was not provided.
This page uses the CFPARAM tag to declare the parameter mon_CLINqty as required for this template. The parameter is not available.Please verify that you have passed or initialized the parameter correctly. If you wish to set a default value for the parameter you should use the DEFAULT attribute of the CFPARAM tag.


 
I'd say:

Code:
<cfparam name="fooPostBackVar" type="numeric" default="">
<cfparam name="fooLocalVar" type="numeric" default="#fooPostBack#">

<input type="text" value="#fooLocalVar#">

I'm sure you tried something like that.. If you did or that doesn't work or whatever...

Code:
<cfparam name="fooPostBackVar" default="">
<cfparam name="fooLocalVar" type="numeric" default="#fooPostBack#">

<input type="text" value="#fooLocalVar#">

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
wemigit

Thanks, but neither of those will work for me. The first and second both set numerics to empty strings, which will certainly fail.

I still have yet to come up with a solution.

Any ideas are still welcome...

 
Can you cfparam the value to 0 and if its 0 not do anything?

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top