How about using cfparam and giving it a default value if it is not submitted.
Russ -----Original Message----- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: 10 October 2006 01:36 To: CF-Talk Subject: Re: Null with cfqueryparam AAAIIEE!!!!! NOT "STRUCKKEYEXIST" !!!! Jezzz Louise! Matt Quackenbush wrote: > The order doesn't matter. Since you're not surrounding it with an if > statement, each one will always process. So effectively, there's no way to do it without using the surrounding "if"? > > > -----Original Message----- > From: Les Mizzell [mailto:[EMAIL PROTECTED] > Sent: Monday, October 09, 2006 7:24 PM > To: CF-Talk > Subject: Re: Null with cfqueryparam AAAIIEE!!!!! NOT "STRUCKKEYEXIST" !!!! > Jezzz Louise! > > Matt Quackenbush wrote: >> It still generates an error because you're still using #form.fax# in >> the value attribute. > > OK, now I'm confused. > > >> fax = <cfqueryparam >> value="#FORM.fax#" >> cfsqltype="CF_SQL_VARCHAR" >> null = "YesNoFormat(NOT (StructKeyExists(form,'fax'))" > > > I'm understanding why the above generates an error: > > value="#FORM.fax#" is evaluated first, so if it doesn't exist, an > error is thrown before it ever gets to the null statement. > > But what if the order is switched? > > fax = <cfqueryparam > null = "YesNoFormat(NOT (StructKeyExists(form,'fax'))" > value="#FORM.fax#" > cfsqltype="CF_SQL_VARCHAR" > > > Seems like the null statement would now evaluate first and it would work. > > But: > "The value of the attribute NULL is invalid. The value cannot be > converted to a boolean because it is not a simple value.Simple values > are booleans, numbers, strings, and date-time values." > > I seem to be getting further and further away from what at first > seemed like a simple solution. What am I missing? I'm trying to avoid: > > <cfif IsDefined("form.fax") AND #xox# NEQ ""> > <cfqueryparam value="#FORM.fax#" cfsqltype="CF_SQL_VARCHAR" > <cfelse> > NULL > </cfif> > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256050 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

