Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | ColdFusion | Q3009 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.