I have a couple ideas (and if what you already solved these things and
it just wasn't in the code you posted, my apologies).

1. can you humour me and try default="0" instead of default=0 ?  I've
never heard of that being an issue (and surely somebody would have
reported it by now), but it wouldn't hurt to rule out.

2. if you do <cfdump var="#url.prodformat_ID#"> immediately before
calling

<cfset getProductsByFormat =
productItemGateway.getProductItemsByFormat(#url.formatID#) />

...what value do you get?

3. Are there other arguments for this method, or just prodformat_ID?
maybe it's assuming you're trying to provide a default value or some
other argument by accident?  Just an idea.

4. and this has nothing to do with your question, but you should
probably change this line:

<cfset qProductsByFormat = "">

to be like so:

<cfset var qProductsByFormat = "">

...var scoping your local queries will prevent various other issues from
happening with the CFC later, that will be difficult to debug.

Hth.


Nolan Erck
Web Developer/Programmer
Schools Financial Credit Union
(916) 569-5409 Office
(916) 569-2024 Fax
www.schools.org

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Aaron Roberson
Sent: Friday, June 23, 2006 12:04 PM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Need Help with Arguments in CFCs

Let me expose myself...

Here's the code:
<cfargument name="prodformat_ID" type="numeric" default=0 required="no">
                
                <!--- create a join query to retrieve product and item
by format --->
                <cfset qProductsByFormat = "">
                <cfquery name="qProductsByFormat"
datasource="#variables.dsn#">
                        SELECT products.prodID, products.prodTitle,
products.ProdSPic,
products.prodSDesc, products.prodSort, products.prodActive,
proditems.prodItemID, proditems.prod_ID, proditems.prodformat_ID,
proditems.prodItemDesc, proditems.prodItemPrice,
proditems.prodItemSpecial, proditems.prodItemSpecialPrice
                        FROM products INNER JOIN proditems ON
products.prodID = proditems.prod_ID
                        WHERE products.prodActive = 1
                        AND proditems.prodformat_ID = <cfqueryparam
value="#arguments.prodformat_ID#" cfsqltype="cf_sql_integer">
                        ORDER BY products.prodSort DESC
                </cfquery>

I am calling and consuming the object as such:

<cfset productItemGateway = createObject("component",
"productItemGateway").init(Application.dsn)>
<cfset getProductsByFormat =
productItemGateway.getProductItemsByFormat(#url.formatID#) />

If I don't specify a formatID in the query string I get the dreaded
error.

-Aaron
On 6/23/06, Peter Bell <[EMAIL PROTECTED]> wrote:
> Hi Aaron,
>
> Just a side note, I wouldn't look at data types as a security feature.
If
> you're receiving user input you'd much rather run a regex or other
> validation to catch invalid inputs (along with queryparam'ing in your
SQL or
> using SP's) as it is much easier to trap the errors. Last thing you
want is
> for an end user to be able to throw a ColdFusion error with a
malformed URL
> string!
>
> Also, "" is indeed a string, it just isn't a number which is what
Nolan was
> saying, so it would error on any kind of numeric data type validation.
>
> Best Wishes,
> Peter
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
> Of Aaron Roberson
> Sent: Friday, June 23, 2006 2:20 PM
> To: CFCDev@cfczone.org
> Subject: Re: [CFCDev] Need Help with Arguments in CFCs
>
>
> Nolan,
>
> I am running ColdFusion 7 on my development machine where I am having
the
> problem. I mentioned that I used default values of 0 and "" because I
also
> thought that "" was technically a string, but had the same problem
when
> switching to 0.
>
> I don't want to change the argument type to any, which would probably
work.
> String would work too. Specifying the datatype has it's advantages -
> security.
>
> -Aaron
>
> On 6/23/06, Nolan Erck <[EMAIL PROTECTED]> wrote:
> > Without seeing some source code all I can think of is....
> >
> > 1. you aren't running ColdFusion 6.0 are you?
> >
> > 2. "This happens even when the argument is optional, and I have
> > default values of 0 or ""
> >
> > ...well technically "" is not a numeric value, so maybe that's part
of
> > the issue?
> >
> > Do you get any better results if you change the argument type to
> > "any"?
> >
> > hth
> >
> > -nolan
> >
> > Nolan Erck
> > Web Developer/Programmer
> > Schools Financial Credit Union
> > (916) 569-5409 Office
> > (916) 569-2024 Fax
> > www.schools.org
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> > Behalf Of Aaron Roberson
> > Sent: Friday, June 23, 2006 10:59 AM
> > To: cfcdev@cfczone.org
> > Subject: [CFCDev] Need Help with Arguments in CFCs
> >
> > It seems that every time I create a cfc with arguments other than
> > string that I get a message like "The argument xxxx passed to
function
> > xxxx is not of type xxxx."
> >
> > This happens even when the argument is optional, and I have default
> > values of 0 or "". Right now it is happening when I don't pass an
> > argument to my cfc even though the argument is optional and the
> > default value is 0 (it's numeric).
> >
> > Any suggestions?
> >
> > Thanks,
> > Aaron
> >
> > P.S. I did a search first, so if this is something that comes up
often
> > and has been answered elsewhere, please forgive me - I tried.
> >
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email to
> > cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the
subject
> > of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported by
CFXHosting
> > (www.cfxhosting.com).
> >
> > An archive of the CFCDev list is available at
> > www.mail-archive.com/cfcdev@cfczone.org
> >
> >
> >
> >
> > The information contained in this e-mail is confidential and may
> > contain privileged information exempt from disclosure under
applicable
> > law. The information is intended only for the use of the individual
or
> > entity to which it is addressed. If you are not the intended
> > recipient, employee, or agent responsible to deliver it to the
> > intended recipient, you are hereby notified that any use,
> > dissemination, distribution, or copying of this communication is
> > strictly prohibited. If you have received this e-mail in error,
please
> > delete the message from your computer and immediately notify the
> > sender by telephone (you may call collect) at 916-569-5400 or by
> > e-mail to [EMAIL PROTECTED] Thank you.
> >
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email to
> > cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the
subject
> > of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported by
CFXHosting
> > (www.cfxhosting.com).
> >
> > An archive of the CFCDev list is available at
> > www.mail-archive.com/cfcdev@cfczone.org
> >
> >
> >
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
> cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject
of the
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.com).
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/cfcdev@cfczone.org
>
>
>
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of
the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
>
> An archive of the CFCDev list is available at
www.mail-archive.com/cfcdev@cfczone.org
>
>
>


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of
the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/cfcdev@cfczone.org




The information contained in this e-mail is confidential and may contain 
privileged information exempt from disclosure under applicable law. The 
information is intended only for the use of the individual or entity to which 
it is addressed. If you are not the intended recipient, employee, or agent 
responsible to deliver it to the intended recipient, you are hereby notified 
that any use, dissemination, distribution, or copying of this communication is 
strictly prohibited. If you have received this e-mail in error, please delete 
the message from your computer and immediately notify the sender by telephone 
(you may call collect) at 916-569-5400 or by e-mail to [EMAIL PROTECTED] Thank 
you.


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/cfcdev@cfczone.org


Reply via email to