Question
What is the implication for using cfparam with the variable scoping requirements
We use cfparam alot in our code to ensure that if a page is loaded and the form variable or url variable has not been sent, then we have a default value to test against. How do I now change the code so that this continues to work. Does this render cfparam useless?
For example:
<cfparam name="lbDrawingISN" default="AddDrawing">
<cfparam name="Archived" default="0">
<cfif lbDrawingISN is "Archived">
<cfset archived = 1>
<cfelseif lbDrawingISN is "Active">
<cfset archived = 0>
<cfset lbDrawingISN = "AddDrawing">
</cfif>
form.lbDrawingISN is submitted.
If I change the code to:
<cfparam name="lbDrawingISN" default="AddDrawing">
<cfparam name="Archived" default="0">
<cfif form.lbDrawingISN is "Archived">
<cfset archived = 1>
<cfelseif form.lbDrawingISN is "Active">
<cfset archived = 0>
<cfset form.lbDrawingISN = "AddDrawing">
</cfif>
It seems that would work, but what if the form.lbDrawingISN value is not provided. Then it wouldn't work. Do you change the param taga
<cfparam name="form.lbDrawingISN" default="AddDrawing">
but then wouldn't the scope be variables.form.lbDrawingISN
Thanks
