Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / April 2007



Tip: Looking for answers? Try searching our database.

using anchor to change a variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
djc11 - 27 Apr 2007 23:55 GMT
I want to have and anchor <a> , not a button, change a CF variable.  First I
was trying to link the anchor to a javascript but since the js was client side
it wasn't working.  I could n't figure out how I could access the variable
directly from the anchor tag either.  My brain is fried from a long day today
but I just can't seem to figure out how to do this.  Any ideas out there?
Dan Bracuk - 28 Apr 2007 02:46 GMT
Link the anchor tag to another cf page and change the variable there.  

iframes might be helpful.   More helpful than the preceding paragraph in fact.
insuractive - 30 Apr 2007 19:50 GMT
It sounds like Dan's suggestion is your best bet - you can even link to the
same page, passing a URL variable at the end of the link that you can use to
change your CF variable:

myPage.cfm
<cfparam name="myVarA" defalut="B">
<cfif isDefined("URL.myVar1")>
   <cfset myVarA = URL.myVar1>
</cfif>

<cfoutput>
<a href="myPage.cfm?myVar1=foo">#myVarA #</a>
</cfoutput>

Can you tell us a little more about what you're trying to accomplish?  There
may be a better solution to your problem.
djc11 - 30 Apr 2007 20:18 GMT
I'm creating a table with subtables that can be included by clicking a (+) on
expandable areas.  I figured if I toggled a boolean var, when a plus (or
minus), was clicked the page would be refreshed with the table displaying the
new query depending on which vars were set to true or false.
insuractive - 30 Apr 2007 23:21 GMT
You should be able to format all your links like this:

MyPage.cfm
---------------------
<cfparam name="bShowSection" default="">
<a href="myPage.cfm?bShowSection=first_section">+</a> First Section
<cfif URL.bShowSection eq "first_section">
     <!--- process code, include file, run query, etc --->
</cfif>

You could also use JavaScript to control your show/hide functionality, which
would be much quicker response-wise, but would require you generate the code
for all your expanded sections at once.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.