SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist kashaziz's Avatar
    Join Date
    Feb 2001
    Location
    PK
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error working with application .cfm URGENT

    Hi folks, its a stupid error but have to solve it somehow, need your help!!!!!

    In Application.cfm
    ====================
    <CFAPPLICATION NAME="hrsglobal"
    CLIENTMANAGEMENT="Yes"
    CLIENTSTORAGE="hrs"
    SETCLIENTCOOKIES="Yes"
    SESSIONMANAGEMENT="Yes"
    SESSIONTIMEOUT=#CreateTimeSpan(0,0,30,0)#
    APPLICATIONTIMEOUT=#CreateTimeSpan(2,0,0,0)#
    SETDOMAINCOOKIES="No" >

    <CFLOCK SCOPE="Application" Timeout="30" Type="Exclusive">
    <cfparam name="application.db" default="hrs">
    <cfparam name="application.pass" default="kashif">

    <cfset application.uid="kashif">
    <cfset application.mailserver="192.168.0.1">
    </CFLOCK>

    In city.cfm
    ===========
    <cfquery name="qcity" datasource="hrs" username=#application.uid# password=#application.pass#>
    select citycode, countrycode, cityname from city
    </cfquery>

    and the error is:
    =================
    An error occurred while evaluating the expression:

    #application.pass#

    Error near line 10, column 77.
    -------------------------------------------------------Error resolving parameter APPLICATION.PASS

    The application variable PASS does not exist. The cause of this error is very likely one of the following things:

    The name of the application variable has been misspelled.
    The application variable has not yet been created.
    The application variable has timed out.

    The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (10:1) to (10:94) in the template file E:\MY PROJECTS\SUPPORT2HRM\SOURCE\ADMIN\CITY.CFM.

  2. #2
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    two possibles i see:

    1.
    are you sure *that* Application.cfm is the one being called by city.cfm?

    are they in the same directory?

    templates look for the closest Application.cfm file they can find...they start in the same folder as the template, and then traverse up the directories of the site, using the first one they find.

    try putting a javascript alert in the Application.cfm template to test if it's being called:

    <script>
    alert('I am the application file in XXX folder');
    </script>

    2.
    also, you should have a read-only lock on those applicaiton variables in query tags in the city.cfm template. you may want to avoid applicaiton variables here -- why not just declare it as a local variable in the applicaiton template? the miniscule amount of memory you're saving with an aplpication scope variable will get gobbled up by the required locks in alot of cases.

    forgetting locks, or using readonly locks when you're trying to write to a locked scope (should be exclusive like you have in the app template) won't always throw an error, sometimes nothing happens (variables dont get written/read, no errors thrown, nothing!)

    hope that helps!

  3. #3
    SitePoint Evangelist kashaziz's Avatar
    Join Date
    Feb 2001
    Location
    PK
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by nagrom two possibles i see:

    1.
    are you sure *that* Application.cfm is the one being called by city.cfm?

    are they in the same directory?
    Actually i have 2 application.cfm, one in current folder and one above it. I assume city.cfm is calling one in current folder

    try putting a javascript alert in the Application.cfm template to test if it's being called:

    <script>
    alert('I am the application file in XXX folder');
    </script>
    Not working

    I will use application variables for other purposes, this is just a demo to check they are passing the values properly

    what to do now?

  4. #4
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, you have application 2 files, and neither one is loading?

    make sure they're spelled right and make sure you have a capital 'A' in Application

    i.e.:
    Application.cfm

  5. #5
    SitePoint Evangelist kashaziz's Avatar
    Join Date
    Feb 2001
    Location
    PK
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still not working

    what is the standard way of passing application variables from application.cfm to another page (like city.cfm) - i just want to check whether the variables persist on next page or not!

  6. #6
    SitePoint Guru nagrom's Avatar
    Join Date
    Jul 2001
    Location
    Western CT, USA
    Posts
    803
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Application.cfm and OnRequestEnd.cfm are really just 'auto-includes' in a way.

    you can't set application scope or session scope variables without initalizing the application first (like your trying to do in the applicaiton file)
    variables can be set anywhere, though many would argue it's a good habit to set application variables in your App file.

    this is where most people put the cfapplication tag too, though i don't think it has to be that way.

    Try putting quotes around your timeout values, that could be the whole problem. (heh)

    if not, make sure your Application.cfm template is being included.

    make three files, name them:
    Application.cfm
    index.cfm
    OnRequestEnd.cfm

    but something simple in each, like:
    <p>Application file</p>
    <p>index file</p>
    <p>End</p>

    browse to index.cfm....were they all included?

    good luck!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •