EasyCFM.COM ColdFusion Forums / Coding Help! / session variable

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: session variable

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

seeker
10-19-2002 @ 10:38 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 3
Joined: Oct 2002

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.
Then,
<cfif IsDefined("Form.AddData")>
   <cfset SESSION.AddData.TagNo    = Form.TagNo>
etc. for all data fields.
Then, in the <body>,
<cfform
   ACTION="AddData.cfm?#SESSION.URLToken#"
   METHOD="POST">
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?

Thanks,
seeker


Webmaster
10-21-2002 @ 9:53 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

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...

Thanks

Thanks,
Pablo Varando
EasyCFM.COM, LLC.

seeker
10-21-2002 @ 10:46 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 3
Joined: Oct 2002

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 -->
<cfapplication
  name="HA"
  sessionmanagement="yes"
  setclientcookies="no">
  <cflock scope="SESSION" type="READONLY" timeout="5">
    <cfcookie name="CFID" value="#SESSION.CFID#">
     <cfcookie name="CFTOKEN" value="#SESSION.CFToken#">
  </cflock>

<!---
<!-- 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">
  </cfif>
    <cfinclude template="/forms/LoginForm.cfm">
    <cfabort>
</cfif>
--->
<!-- Display message for "request" errors -->
<cferror
  type="request"
  template="/templates/ErrorRequest.cfm">
<!---
  mailto="#ErrorEmail#">
--->
<!-- Display message for "exception" errors -->
<cferror
   type="exception"
   exception="any"
   template="/templates/ErrorException.cfm">
<!---
   mailto="#ErrorEmail#">
--->  
<!-- Display message for "validation" errors -->  
<cferror
   type="validation"
   template="/templates/ErrorValidation.cfm">

<!--- 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 = "">
</cfif>

<!-- 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>
</cfif>

<html>
<head>
<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");
-->
</style>
</head>

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

<!-- Data entry form that submits back to itself -->
<cfform
   ACTION="AddServer.cfm?#SESSION.URLToken#"
   METHOD="POST">

<!-- Display text entry field for Tag Number -->
Tag No.<BR>
  <cfinput  NAME="TagNo"
  VALUE="#SESSION.AddServer.TagNo#"
  SIZE="15"
  REQUIRED="Yes"
  MESSAGE="Required">

<!-- Display text entry field for Serial Number -->
Serial No.<BR>
<cfinput  NAME="SerialNo"
  SIZE="15"
  REQUIRED="Yes"
  MESSAGE="Required"
  VALUE="#SESSION.AddServer.SerialNo#">
  
<!-- Display text entry field for Purchase Order Number -->
Purchase Order No.<BR>
<cfinput  NAME="PONumber"
  SIZE="10"
  REQUIRED="Yes"
  MESSAGE="MCCD P. O. Number"
  VALUE="#SESSION.AddServer.PONumber#">

<!-- Display text entry for Purchase Date -->  
Purchase Order Date<BR>
<cfinput  NAME="PODate"
  SIZE="8"
  REQUIRED="No"
  MESSAGE="Format is mm/dd/yy"
  VALUE="#SESSION.AddServer.PODate#">

<!-- Display text entry field for Date Received -->
Date Received<BR>
<cfinput  NAME="DateRcvd"
  SIZE="8"
  REQUIRED="Yes"
  MESSAGE="Format is mm/dd/yy"
  VALUE="#SESSION.AddServer.DateRcvd#">
     
<p>
<!-- Display Finish button -->
  <Input type="Submit" NAME="GoDone" VALUE="Submit">
</cfform>

</body>
</html>





Website Designed and Developed by Pablo Varando.