Roland
Roland

Reputation: 7863

Is the addtoken parameter in the location function(cflocation tag) a boolean?

I'm using CF9.

The function cflocation has a parameter

addToken = "yes|no"

It is not mentioned if this is actually a boolean, e.g. are the following two equivalent?

<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "no">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "false">

When calling this method in cfscript using the function Location can I pass a boolean as a parameter?

<cfscript>
   location(url="http://localhost:8500/administrator", addtoken = false);
</cfscript>

Upvotes: 1

Views: 1245

Answers (1)

Nebu
Nebu

Reputation: 1793

Yes they are the same and yes you can pass them in cfscript as a parameter. You can even use 0 and 1.

For false:

<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "no">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "false">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "0">
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = false);</cfscript>
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = "no");</cfscript>
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = 0);</cfscript>

For true:

<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "yes">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "true">
<cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "1">
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = true);</cfscript>
<cfscript>location(http://localhost:8500/cfdocs/dochome.htm", addtoken = "yes");</cfscript>
<cfscript>location(url="http://localhost:8500/cfdocs/dochome.htm", addtoken = 1);</cfscript>

BTW you could easily verify this you self by creating a small sample file and test it.

Upvotes: 4

Related Questions