Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null attribute in cfprocparam - is this a bug

Status
Not open for further replies.

jimmyshoes

Programmer
Jun 1, 2008
132
GB
I'm using cf8

Code:
<cfprocparam type="in" null="true" value="#Trim(arguments.attributes.strCircuit)#" cfsqltype="cf_sql_varchar">

If null is true I thought that the value attribute would be ignored
Yet the following code generates this error
Element ATTRIBUTES.STRCIRCUIT is undefined in ARGUMENTS.

Is this a bug?
 
To clarify the above
Shouldn't the code below work, instead it says that varNotDefined is undefined

Code:
<cfprocparam type="in" null="true" value="#varNotDefined#" cfsqltype="cf_sql_varchar">
 
<cfprocparam type="in" null="true" value="#varNotDefined#" cfsqltype="cf_sql_varchar">

varNotDefined is not defined. why don't you do something like this before the cfproc?

<cfif Not IsDefined('varNotDefined')>
<cfset varNotDefined = ''>
</cfif>

 
If null is true I thought that the value attribute would be ignored
Yet the following code generates this error
Element ATTRIBUTES.STRCIRCUIT is undefined in ARGUMENTS.

Yes, the description could be improved. Strictly speaking it means CF will send a NULL to the database instead of whatever you have for the "value". So CF always evaluates your variable, whether it is used or not.

----------------------------------
 
or you could do this:
Code:
<cfprocparam type="in" <cfif IsDefined('varNotDefined')>
value="#varNotDefined#" <cfelse>null="true"</cfif>cfsqltype="cf_sql_varchar">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top