Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q3009 How can I make sure that required and/or optional parameters are passed to my ColdFusion template?

You are here: irt.org | FAQ | ColdFusion | Q3009 [ previous next ]

Use the following script:

<!--- optional parameters --->
<cfparam name="optParam1" default="true">
<cfparam name="optParam2" default="">

<!--- required parameters --->
<CFLOOP index="param" list="optParam1,optParam2">
	<CFIF Evaluate(param) EQ "">
		<HR>
		<H4>Missing Parameter</H4>

		You need to specify a value for the '<B><CFOUTPUT>#param#</CFOUTPUT></B>' parameter. This parameter is required.
		<HR>
		<CFABORT>
	</CFIF>
</CFLOOP>

©2018 Martin Webb