CFPARAM is the equivalent of:
CFIF not isDefined(myvar)
CFSET myvar = defaultvalue
/CFIF
CFPARAM is good for things like Custom tags, but I recommend not over
using it.
At 03:48 PM 09/04/2001 -0500, you wrote:
Hey guys i still don't understand the difference between CFPARAM and
You can use cfparam to make sure a variable is defined (such as form, url, or
session variables).
Brian Yager
President - North AL Cold Fusion Users Group
Sr. Systems Analyst
NCCIM/CIC
[EMAIL PROTECTED]
(256) 842-8342
-Original Message-
From: Fuon See Tu [mailto:[EMAIL PROTECTED]]
CFparm only writes to the variable if the variable does not exist, where
as CFSet overwrites the variable with a new value regardless of if it
exists.
EX:
cfparam name=form.checkbox default=0
is the same in principle as:
cfif NOT isDefined()
cfset form.checkbox = 0
/cfif
HTH,
Duane
CFSET assigns a value to a variable.
CFPARAM makes sure a variable exists (with a given default value if
specified).
The two ideas are a little different.
If I have passed a URL variable to my page (call it URL.MyVar), then I can
do processing on my page using that variable.
However, if I do
Well for starters.
CFSET sets a defined valuable for a variable, while CFPARAM
allows you to set a DEFAULT value for a variable that only gets
used if the variable does not exist at that stage of the form being
processed
Terry
- Original Message -
From: Fuon See Tu [EMAIL PROTECTED]
Hey guys i still don't understand the difference between
CFPARAM and CFSET. anyone got a working concept? i see no
use for CFPARAM :)
This:
cfparam name=Form.myfield default=someval
is the same as this:
cfif not IsDefined(Form.myfield)
cfset Form.myfield = someval
/cfif
Also,
Here's a common use for CFParam ... at least for me ...
Let's say I have a form that can be used either for updating existing data
OR for inserting new data.
If the form will function as update, I'll want to display the existing data,
such as:
cfinput type=text name=fname
CFSET - expicitly set the variable to the value specified
CFPARAM - if the variable specified already exists then leave it alone; if
it doesn't already exist then create it and set it to the value of the
DEFAULT parameter.
an easy example: you fill out a form and have, say, a checkbox. If the
8 matches
Mail list logo