Skip to main content
Inspiring
August 11, 2010
Question

CFC & URL Vars

  • August 11, 2010
  • 1 reply
  • 900 views

Hello,

I am using code from Fullcalendar to invoke a CFC. It passes URL vars that I need to access in the CFC. How do I access them?

js code

...

events: "/tools/calendar_portal/calendar.cfc?method=queryEvents&calendarid=21,23&returnformat=plain",

...

more js code

    This topic has been closed for replies.

    1 reply

    Inspiring
    August 11, 2010

    You're not "accessing a CFC", you're calling a method of the CFC.  When calling a method via an HTTP request, the URL parameters other than the METHOD one are passes to the method as arguments (and accordingly are in the arguments scope).

    --

    Adam

    jbreslowAuthor
    Inspiring
    August 12, 2010

    Yes you are correct Adam, I am not accesing a CFC, I am calling a Methond. My bad.

    When I try and use the variable that is being passed in the URL to the Method I get an error that says that Argument.myURLvar is not defined.

    method=queryEvents&calendarid=21,23&startDate=29&startMonth=2&startYear=2010&endDate=10&endMonth=4&endYear=2010

    <cffunction name="queryEvents" access="remote">

    <cfargument name="startMonth" required="no">

    <cfoutput>
            #arguments.startMonth#
    </cfoutput>

    </cffunction>

    Error:

    Element STARTMONTH is undefined in ARGUMENTS.

    Inspiring
    August 12, 2010

    If the traditional method of linking to a .cfm file which calls the method from the .cfc file is available, that might be a simpler approach.