Ask a Question related to Macromedia ColdFusion, Design and Development.
-
benkayuk #1
Set session variable on image click
Hi there guys,
Having a problem...I want to set a language session variable when a user
clicks on a flag which is in an image map on the index page.
At the moment, the hotspot just links to 'index2', but how can I make it set a
language variable and go to index2 also?
This is a big hole in my CF knowledge, I hope someone can help me fill it!
Thanks, Ben
benkayuk Guest
-
#39634 [NEW]: session variable and normal variable
From: erhanbaris at gmail dot com Operating system: Win Xp SP1 PHP version: 5.2.0 PHP Bug Type: Variables related Bug... -
Click event on Image Control
Hello , There is an Image control created on the page, the logic: when user clicks on the Image, it needs to perform some action(such as calling... -
Save variable on a click
I have a menu made up of images where users can click an image to load the next page. I want each image to send a unique id number to the page the... -
Datalist - how (if) to use a sub variable or session variable in the footer?
Hi, sorry to be greedy with all my posts lately, but can you tell I'm doing new things this week? I've just done my first datalist (a simple... -
[SESSION] Session variable deleted prior to command?
Hi all, I'm developing a database system on my local computer (OS/version details at bottom) with a simple user authentication using sessions. On... -
Stressed_Simon #2
Re: Set session variable on image click
In all honesty you are best to pass this as a URL variable and then set that to a session variable on the index2.cfm page.
Make sense?
Stressed_Simon Guest
-
benkayuk #3
Re: Set session variable on image click
Hi Simon,
Ok makes sense....but how do I set the url to a session variable on the second page?
Ben
benkayuk Guest
-
Stressed_Simon #4
Re: Set session variable on image click
<cfset URL.CountryID = SESSION.CountyID>
Stressed_Simon Guest
-
benkayuk #5
Re: Set session variable on image click
OK, I've turned the image into sending an url variable 'lang'...so it gets to
index2 as index2.cfm?lang=en
On my index2.cfm page I have <cfset URL.lang = SESSION.lang> right at the top
(above the <head> tag).
That's the only coldfusion stuff I have at the top of that page. Now, when I
go to site_root/dehler25/25boatoverview.cfm ....which is set to draw text from
a DB WHERE lang = SESSION.lang I get nothing!!!
I tested the overview page with a simple URL variable and it worked...is there
somewhere I need to put something in an application.cfm file...or do I need
more code at the top of index2.cfm ??
Hope you can help me further, really appreciated,
Ben
benkayuk Guest
-
Stressed_Simon #6
Re: Set session variable on image click
Sorry I assumed that you knew how to turn on SESSION variables.
You need to put this in your Application.cfm:-
<cfapplication
name="yourApplicationName"
sessiontimeout="#CreateTimeSpan(0, 0, 30, 0)#"
sessionmanagement="yes">
Stressed_Simon Guest
-
benkayuk #7
Re: Set session variable on image click
Hmm....well I had this already in my root directory...is that the place it
should be?
<cfapplication NAME="language">
<cfapplication sessionmanagement="yes">
</cfapplication>
I'm not that bothered about it timing out...or should I be?
Also, where does the application name link to? Because I have no mention of it
anywhere else...i just chose it out of the blue!
Ben
benkayuk Guest
-
Stressed_Simon #8
Re: Set session variable on image click
OK well basically the application name does not matter too much. It is just
that if you change it at any point all the client, session and application
variables will be reset.
As for the timeout, that is how long the session variables will last if there
is not action by the user. Basically how long they can leave their browser idle
before the variables are deleted from Application memory. The value set here
overides the default set in the CF administrator, but will not be able to be
above the max set in CF Admin.
I have never used cfapplication with a closing tag, I am pretty sure it
doesn't work. try how I showed you and if it works then it should answer you
question!
Stressed_Simon Guest
-
benkayuk #9
Re: Set session variable on image click
OK, changed my application.cfm but still no joy.
I sometimes get an error on my index2.cfm page even when I click through from
the language selection page (index.cfm)....
All I have at the top of index2.cfm is...
<cfset URL.lang = SESSION.lang>
<html>
<head>
<link rel="shortcu........
Is that really all that is required up there?
The error I sometimes get on index2.cfm is :
Element LANG is undefined in SESSION.
The error occurred in C:\CFusionMX7\wwwroot\CFIDE\dehler\index2.cfm: line 1
1 : <cfset URL.lang = SESSION.lang>
2 : <html>
3 : <head>
Hope you have a clue! Ben
benkayuk Guest
-
Stressed_Simon #10
Re: Set session variable on image click
Well a good start would be renaming application.cfm to Application.cfm. Also check that Session variables are enabled in the CF administrator!
Stressed_Simon Guest
-
benkayuk #11
Re: Set session variable on image click
Yep, changed to Application.cfm and session variables are (were already)
enabled.
What I don't understand is why I get the message Lang is undefined in Session,
when the only command on the index2.cfm page is to actually SET the session in
the first place!
Any ideas?
Ben
benkayuk Guest
-
Stressed_Simon #12
Re: Set session variable on image click
I am so sorry I have been half asleep here. I got it the wrong way round.
<cfset SESSION.Lang = URL.Lang>
Stressed_Simon Guest
-
benkayuk #13
Re: Set session variable on image click
Hahaha, jeez that solved everything!!
Then again, I should have spotted it too! lol
Thanks for all your help!
Ben
benkayuk Guest
-
Amadeyo #14
Re: Set session variable on image click
Hi, I'm also having problem with the session variables in cf. Well, it is really my first time to use cf in my web dev., and i becoming to like really. Implementing of queries is awesome so simple and manipulating at the same time. But every thing looks fine until I reached session part w/c really give me headache dealing with it. Unlike sesssion variables in php quite ease to handle but cf, i'm really having trouble, I can't get it. @Stressed_Simon, you know what I did in order to prevent the problem you encountering "undefined", I create file for my application and include it in all my pages... But the trick works, just don't sure if it the correct way.
Amadeyo Guest



Reply With Quote

