Topic: session variable

seeker    -- 10-19-2002 @ 10:38 PM
  I'm trying to use session.urltoken in place of the CFID and CFTOKEN set by Cold Fusion (I can't use cookies in my application.)  I've enabled session management in the CF Administrator. I've set up an application.cfm and set clientcookies=no, sessionmanagement=yes, and my application name.
I've created a form using the following code:

<cfif (NOT IsDefined("SESSION.AddData"))>
   <cfset SESSION.AddData = StructNew()>
and then used <cfset> to define the structure.
<cfif IsDefined("Form.AddData")>
   <cfset SESSION.AddData.TagNo    = Form.TagNo>
etc. for all data fields.
Then, in the <body>,
Tag Number<BR>
  <cfinput  name="TagNo"
etc., for all data fields to be input.

When I preview this in my browser, I get an "element urltoken is not defined in session" error message.  Plus, my first field (tag number) does not display an entry blank--which pulls all subsequent fields up one entry blank.

Can someone tell me where I've messed up?


Webmaster    -- 10-21-2002 @ 9:53 AM
  Please post the following items for a solution:

A copy of the code in the Application.cfm file. So we can see how the variables are being set.
A copy of the code in the page that is giving you an error...


Pablo Varando

seeker    -- 10-21-2002 @ 10:46 AM
  My "in progress" application.cfm is...

<!--- Set constant variables for all pages --->
<cfset Datasource = "HA">
<!--- code to check out
<CFSET request.datasource = "HA">
and then in all templates do:
<CFQUERY datasource="#request.datasource#" ...>

<cfset SiteName = "HA">
<!-- Enable session variables -->
  <cflock scope="SESSION" type="READONLY" timeout="5">
    <cfcookie name="CFID" value="#SESSION.CFID#">
     <cfcookie name="CFTOKEN" value="#SESSION.CFToken#">

<!-- If user is not logged in, force login -->
<cfif NOT IsDefined("SESSION.Auth.IsLoggedIn")>
  <!-- If the user is now submitting the login form,
  include "LoginCheck" code to validate user -->
  <cfif IsDefined("Form.UserLogin")>
    <cfinclude template="/forms/LoginCheck.cfm">
    <cfinclude template="/forms/LoginForm.cfm">
<!-- Display message for "request" errors -->
<!-- Display message for "exception" errors -->
<!-- Display message for "validation" errors -->  

<!--- Include Site Header on every page --->
<cfinclude template="/templates/HaHeader.cfm">

My "in progress" template to collect data for entry...

<!-- The SESSION.AddServer structure holds users' entries -->
<!-- as they move through the process. Make sure it exists -->
<cfif (NOT IsDefined("SESSION.AddServer"))>
<!-- If structure is not defined, create/initialize it -->
   <cfset SESSION.AddServer = StructNew()>

<!-- Display empty fields for data entry -->
   <cfset SESSION.AddServer.TagNo    = "">
   <cfset SESSION.AddServer.SerialNo = "">
   <cfset SESSION.AddServer.PONumber = "">
   <cfset SESSION.AddServer.PODate   = "">
   <cfset SESSION.AddServer.DateRcvd = "">

<!-- Hold data entries -->
<cfif IsDefined("Form.AddServer")>
   <cfset SESSION.AddServer.TagNo    = Form.TagNo>
   <cfset SESSION.AddServer.SerialNo = Form.SerialNo>
   <cfset SESSION.AddServer.PONumber = Form.PONumber>
   <cfset SESSION.AddServer.PODate   = Form.PODate>
   <cfset SESSION.AddServer.DateRcvd = Form.DateRcvd>

<title>Add/Delete Server Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="/Templates/SiteStyle.css" rel="stylesheet" type="text/css">
<style type="text/css">
@import url("/Templates/SiteStyle.css");

<!-- Show title -->
   <center><h3>Add Server Form</h3></center><BR>

<!-- Data entry form that submits back to itself -->

<!-- Display text entry field for Tag Number -->
Tag No.<BR>
  <cfinput  NAME="TagNo"

<!-- Display text entry field for Serial Number -->
Serial No.<BR>
<cfinput  NAME="SerialNo"
<!-- Display text entry field for Purchase Order Number -->
Purchase Order No.<BR>
<cfinput  NAME="PONumber"
  MESSAGE="MCCD P. O. Number"

<!-- Display text entry for Purchase Date -->  
Purchase Order Date<BR>
<cfinput  NAME="PODate"
  MESSAGE="Format is mm/dd/yy"

<!-- Display text entry field for Date Received -->
Date Received<BR>
<cfinput  NAME="DateRcvd"
  MESSAGE="Format is mm/dd/yy"
<!-- Display Finish button -->
  <Input type="Submit" NAME="GoDone" VALUE="Submit">


EasyCFM.COM ColdFusion Forums :