On 12/15/00, Eric Fickes penned:
>Could anybody school me in the difference between using CFPARAM and CFSET.
>I see CFPARAM all the time, but the little documentation that I've seen
>about CFPARAM makes it sound just like CFSET.

cfparam sets a "default" value that will be replaced by another value 
if one is defined. So, if you open a page that has several conditions 
based on the action:

<cfif action is "">
Do nothing
<cfelseif action is "Do This">
Do this
<cfelseif action is "Do That">
Do that
</cfif>

You can use <cfparam name="action" default=""> at the top of the 
page, or anywhere before the cfif statement.

Then when you open that page, since no action has been defined either 
via url or form post, or hasn't been "cfset", the action will have 
been defined as "" and no error will be returned. But if you click a 
form that has:

<input type="hidden" name="action" value="Do This">

And send it to the same page, the action will then be "Do This".

Whereas if you did the same thing using <cfset action = "">, the only 
way to replace the action would be to use another cfset tag AFTER the 
original.

Example 1:

<cfset action="action1">
Some code
<cfset action="action2">

Here the action is "action2".

Example 2:

<cfparam name="action" default="action1">
Some code
<cfset action="action2">

Again the action is "action2"

But, in example 3:

<cfset action="action1">
Some code
<cfparam name="action" default="action2">

Here the action remains as "action1". Only if action1 hadn't been set 
via cfset or a form post or url variable would the action be action2.
-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to