2 Replies Latest reply on Aug 15, 2006 9:24 AM by netpagino

    cferror error??

      I am using the cferror tag within Application.cfm to display a more user friendly message should any errors occur, the problem is I'm currently get an unexplained occurence.

      - I have a page in an iframe that is used for users to update a record held in a MS SQL database.
      - Upon submission the update page loads and updates the record as required.
      - cflocation is used to redirect back to another page in the iframe with a refresh variable.
      - This variable is then picked up on the page using isDefined and then should update it's parent page using the 'script' tab, ie;
      - The parent page has a cfquery on it that gets variables that are used in the page in the iframe, therefore if the parent dosen't refresh the variables don't exist and the iframe page fails.

      The refresh variable is being picked up without a problem but the cferror kicks in displaying an error of a missing variable. The strange thing is that if I remove/comment out the cferror tag from the application page the iframe generates fine, no error at all .

      Are cfm pages generated differently if the cferror tag is used, ie; all coding is generated in the background (Coldfusion and javascript, etc) and then sent to the page, whereas without the cferror tag the page is generated on the fly???

      Admittedly I'm completely guessing as I don't really know how it works!!
        • 1. Re: cferror error??
          BKBK Adobe Community Professional & MVP
          Coldfusion opens the page at least twice, once when it is unrefreshed and once when it is refreshed. Since Application.cfm runs at the beginning of a request, it will also run just before the unrefreshed page is opened. The presence of the cferror tag in Application.cfm will make Coldfusion to fire the cferror event immediately an exception is detected in a request. That is probably how Coldfusion gets aware of the missing variables.

          Keep the cferror tag. Then do either of

          1) <cfparam name="nameOfVariableColdfusionComplainsIsMissing" default="someValueToKeepCFQuiet">

          2) Append the query-string ?refresh=1 to the (refreshed) URL you're redirecting to, then modify your code as follows

          <cfif isDefined("URL.refresh") and URL.refresh EQ 1>
          <!--- code for refreshed variables--->
          <!--- code for unrefreshed variables--->

          • 2. Re: cferror error??
            netpagino Level 1
            I have a simular issue with an application I have.

            Coldfusion complains that a variable is undefined in a page, the session variable is a dynamic variable that I put together after collecting some information. Here is how it works.

            A student selects a class: 130L
            A sudentt selects the location for the class: Location

            Then I set the session variable: session.130L_Location = the value selected (NY)

            If the student selects (decide later) for the location of the class, then I set the value of session.130L_Location to 0

            In the fron end, there are no errors reported at all, however I keep getting the error email saying that session.130L_Location is undefined. Now the cferror tag is executed, the error email is sent, but there is no redirection of the user to the error page. The user stays in the screen they are in and no instances of an error are showed to the user.

            Just so you know .. at all times session.130L_Location is defined ..

            I'm not sure what is going on here ..