Link to home
Start Free TrialLog in
Avatar of APS NZ
APS NZFlag for New Zealand

asked on

Problem with ColdFusion session vars with FireFox

I have an online data entry form which works fine in IE, but not in FireFox.  FireFox does not seem to recognise ColdFusion session variables.

I set up an ultra simple test and it doesn't work.  I have a form  - Test.cfm with this code
<CFSET session.MyDate=CreateODBCDate(Now())>
<CFLOCATION URL="Test2.cfm" addtoken="no">

Open in new window


Test2.cfm looks like this
<CFOUTPUT>
#DateFormat(session.MyDate,"dd/mm/yyyy")#
</CFOUTPUT>

Open in new window


When I run Test.cfm, as expected Test2.cfm opens and displays the date, but when I run the FireFox debugger it tells me
 
<h2>500 - Internal server error.</h2>
  <h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
......
<h1 id="textSection1" style="COLOR: black; FONT: 13pt/15pt verdana">
       Element MYDATE is undefined in SESSION. </h1>

Open in new window


This of course in the data entry form stops things from processing.  How do I fix this problem?
Avatar of gdemaria
gdemaria
Flag of United States of America image

Session variables work by using cookies, cookies are written when the page is fully displayed.   So, by doing a CFLOCATION after setting a session variable for the first time, you are preventing the page from writing (by redirecting it to another page)  - so the session variable is never set.

Remove the CFLOCATION and try again.  IF that doesn't work right away, change the name of your CFAPPLICATION to clear things out and try it.
Avatar of APS NZ

ASKER

Thanks for the reply gdemaria - As I said, it was a simple test (too simple ;-) ).  I have tried again using a form with a submit button to post to the 2nd page and I still get the same result.
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of APS NZ

ASKER

Thanks gdemaria - You mentioned jsession variables and I read up about them and turned them on in the Administrator.  The problem has now gone away.