Solved

Variable Problem from page to page

Posted on 2002-04-30
4
174 Views
Last Modified: 2013-12-24
If I create a variable using

<CFSET NumStores = GetMCStoreCodes.RecordCount>

right after a query, it holds the value on that page but when I get to the action page specified in the <CFFORM> it loses it's value.  What do I need to retain this value from page to page?  I thought this was an application variable and that application variables keep their value for 2 days and page to page. Be speciffic.
0
Comment
Question by:Anadaboy
  • 3
4 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 6982118
to set an application level var do this:

<cflock timeout="" throwontimeout="Yes" type="EXCLUSIVE" scope="APPLICATION">
  <cfset APPLICATION.NumStores = GetMCStoreCodes.RecordCount>
</cflock>

make sure you have application management on using application.cfm

CJ
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 200 total points
ID: 6982124
If you just want the data passed to the next page then you can use either SESSION or URL params or a hidden form field.

for hidden form field add this to your cfform:

<input type="hidden" name="NumStores" value="#GetMCStoreCodes.RecordCount#">

you can access it on the action page using FORM.NumStores.

You can also use URL parameters it works the same as the FORM code above but gets passed via the URL and accessed via URL.NumStores

the third and final option would be session data.

Again you need to make sure application.cfm exists and has session/application managment enabled (look at your cf documentation for sample application.cfm code.. it is very simple)

Now for session var use:

<cflock timeout="" throwontimeout="Yes" type="EXCLUSIVE" scope="SESSION">
 <cfset SESSION.NumStores = GetMCStoreCodes.RecordCount>
</cflock>

you can access this on the action page using: SESSION.NumStores.

BTW: in my first comment you can access the variable in the action page using APPLICATION.NumStores

HTH,
CJ
0
 

Author Comment

by:Anadaboy
ID: 6984933
Multiple ideas from one question.  You're great.  Thanks again.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6986127
No problem, Glad I could help and Thanx for the "A"
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question