Paul,

Its two parts... One is making sure it only shows once... The other is
getting the active message. 

ONE

You could set a session flag for message and CFParam:

<cfparam name="SESSION.ShowMessage" type="boolean" default="true" />

<cfif SESSION.ShowMessage>

   // SHOW MESSAGE

  // Set so it doesn't show again.
  SESSION.ShowMessage = false;

</cfif> 


The Param puts a default value into the ShowMessage session value. Once the
message get's shown, you set the flag to be false. If the page is reloaded,
the CFParam will NOT put the "true" back into the value since it already
exists (but is set to false). 


TWO

I would wait till you are in the <cfif SESSION.ShowMessage> if statement
before you go to the database. That way, you only have to go to the DB that
one time instead of every page load. So, inside the IF statement, query for
the alert where is_active = 1 (OR whatever flag you use). Then check to see
if you have a record count. If so, alert message. EVEN if you do NOT have a
record count, still set the ShowMessage to false so that you don't have to
keep checking. 


Hope that helps.

.......................
Ben Nadel 
Web Developer
Nylon Technology
350 7th Avenue
Floor 10
New York, NY 10001
212.691.1134 x 14
212.691.3477 fax
www.nylontechnology.com
 
"Some people call me the space cowboy. Some people call me the gangster of
love."

-----Original Message-----
From: Paul Ihrig [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 09, 2006 4:31 PM
To: CF-Talk
Subject: session question set & clear

i am new to session & application variables &am  just trying to figure out a
way to make a pop-up only display once per session.
and only if the last message entered in the db is set to active.

any help would be awesome.
just so i can understand this simple thing..
thanks!
-paul

ok i have an application cfm type of question.
i am not sure where to put the info & how to rest it.

i have a form that an admin inserts a network broadcast print message in.
it is only an insert into a db.

it either sets the message to active=1 with a message filed or to 0,

then there is a pop up page that i want triggered from application.cfm

if the last record from record set dbo.accBroadcast.Active = 1 and
SESSION.UserHasSeenBroadcast = 0 pop-up the message then set
SESSION.UserHasSeenBroadcast = 1

but i am not sure if i should set SESSION.UserHasSeenBroadcast = 0 in the
application.cfm and then reset it in the actual pop-up?




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243106
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to