home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows how CFPARAM operates --->
- <CFPARAM name="storeTempVar" default="my default value">
- <CFPARAM name="tempVar" default="my default value">
-
- <!--- check if form.tempVar was passed --->
- <CFIF IsDefined("form.tempVar") is "True">
- <!--- check if form.tempVar is not blank --->
- <CFIF form.tempVar is not "">
- <!--- if not, set tempVar to value of form.tempVar --->
- <CFSET tempVar = form.tempVar>
- </CFIF>
- </CFIF>
-
- <HTML>
-
- <HEAD>
- <TITLE>
- CFPARAM Example
- </TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <H3>CFPARAM Example</H3>
- <P>CFPARAM is used to set default values so that
- the developer does not need to check for the existence
- of a variable using a function like IsDefined.
-
- <P>The default value of our tempVar is "<CFOUTPUT>#StoreTempVar#</CFOUTPUT>"
-
- <!--- check if tempVar is still the same as StoreTempVar
- and that tempVar is not blank --->
- <CFIF tempVar is not StoreTempVar and tempVar is not "">
- <H3>The value of tempVar has changed: the new value
- is <CFOUTPUT>#tempVar#</CFOUTPUT></H3>
- </CFIF>
-
- <P>
- <FORM ACTION="cfparam.cfm" METHOD="POST">
- Type in a new value for tempVar, and hit submit:<BR>
- <INPUT TYPE="Text" NAME="tempVar">
-
- <INPUT TYPE="Submit" NAME="" VALUE="submit">
-
- </FORM>
-
- </BODY>
- </HTML>
-