QuickTip: Using Name (Label) Links with CFLOCATION

 
Aug 07, 2000
by Douglas Smith of TeraTech, Inc.

If you use a name label in CFLOCATION you must double up the #:

<CFLOCATION  url="index.cfm?##mylabel">

The main problem comes when you use URL variable in combination with labels, since it will corrupt the last URL variable in the string.

In the following example,

<CFLOCATION  url="index.cfm?fuseaction=main##mylabel">

FuseAction will evaluate to the following undesired value:

URL.FuseAction = main#mylabel

The way around this is to set a dummy URL variable that you don't use in your ColdFusion code, like the following:

<CFLOCATION  url="index.cfm?fuseaction=main&temp=1##mylabel">

Some HTML Basics: If You Don't Know About Labels

If you don't know, you can jump down to a specified location in a long HTML page by setting labels, and linking to them. The syntax is a little different from regular links.

Define a location/label on a long HTML page like this:

<a name="mylabel">text goes here</a>

and then link to the label from the same page, as in:

<a href="#mylabel">

or from a different page, as in:

<a href="http://mydomain.com/mypage.cfm#mylabel">

Here the # symbol does NOT indicate a CF variable, and is part of the HTML specifications.


Privacy | FAQ | Site Map | About | Guidelines | Contact | Advertising | What is ColdFusion?
House of Fusion | ColdFusion Jobs | Blog of Fusion | AHP Hosting