Variables and This scopes and the onRequest method

Rex posted this on the CFDEV list (I think it bears repeating):

The VARIABLES scope is the default scope for an unscoped variable, and is shared with the cfincluded page that is called by the onRequest method. The THIS scope only exists in a CFC or in a method of the CFC. Since the cfinclude is called in a method, then the THIS scope is available in the cfincluded page. When there is no onRequest method, the page is just executed, and the called page, test.cfm, does not have access to any of the cfc variables, so VARIABLES scope is empty, and the THIS scope does not exist.

cflogin documentation really sucks

I think the cflogin documentation really sucks because Coldfusion is so easy and so flexible.

That is, there are so many cool things you can do once a user is authenticated that Adobe has failed to provide a very simple example.


<cfset authUserFail = false>
<cflogin>
<cfif isDefined("cflogin") and len(cflogin.name) and len(cflogin.password)>
<cfldap server="ldap"
action="query" attributes="dn"
filter="(uid=#cflogin.name#)"
start=""
name="findUser">

<cfif findUser.recordCount>
<cftry>
<cfldap server="ldap" action="query" attributes="n"
filter="(uid=#cflogin.name#)" start=""
username="#findUser.dn#" password="#cflogin.password#" name="authUser">

<cfcatch>
<cfset authUserFail = true>
</cfcatch>
</cftry>
<cfif not authUserFail and authUser.recordCount eq 1>
<cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="">
<cfset session.user = cflogin.name>
<cfelse>
<cfset request.infoWarningsErrors.addError('authUserFail','Authentication failed')>
<cfinclude template="dsp_login.cfm">
</cfif>
<cfelse>
<cfset request.infoWarningsErrors.addError('findUserFail','Authentication failed')>
<cfinclude template="dsp_login.cfm">
</cfif>
<cfelseif isDefined("cflogin") and (not len(cflogin.name) and not len(cflogin.password))>
<cfset request.infoWarningsErrors.addError('noblanks','Please enter username and password')>
</cfif>
</cflogin>
<cfif len(getAuthUser()) and (not structKeyExists(session,"user")>
<cfldap server="ldap" action="query" attributes=""
filter="(uid=#getAuthUser()#)" start="" name="refreshUser">

<cfif refreshUser.recordCount eq 1>
<cfset session.user = getAuthUser()>
        DO SOME CLEVER SESSION.USER STUFF HERE    
</cfif>
</cfif>
<cflog file="lostsession" text="#getAuthUser()#, #isDefined('cflogin')#, #yesNoFormat(authUserFail)#, #isDefined('authUser')#, #isDefined('refreshUser')#">
</cfif>

Analysts at Gartner Praise Coldfusion

I am posting this in case I need ammunition the next time I lobby to use Coldfusion.

Analysts at Gartner Praise CF

The ColdFusion note / report can be purchased from Gartner.

Other quotes from Mark in the note:

"...ColdFusion can provide unique value that is not fully addressed by any competing alternative technology. Most notably, ColdFusion is unmatched by any competitor for ease of use and technical capabilities. When we combine this with cross-platform deployment,and significant integration into both Java and .NET, ColdFusion stands out as a compelling solution for many IT challenges."

"ColdFusion provides a potential wrapper around the complexity of Java, providing Web developers access to the power of the Java platform via the productivity of a fourth-generation language (4GL)."

"ColdFusion is nearly unique in the industry because it provides a balance of ease of use and advanced features that can support "entry level" business unit application developers, as well as "advanced" centralized IT development teams."

"We also believe ColdFusion will play a pivotal role in Adobe's Flash Platform (www.adobe.com/flashplatform). Developers with investments in Flash, Flex, Air, BlazeDS and PDF Forms will find ColdFusion an integral supporting player in this technology family."

Mark recommends you ...

"Consider This Product When

• You need to deliver robust Web applications, and alternatives such as .NET or Java are overkill

• You are invested in Java and Java EE, and need developer productivity to better your investment in Java

• You need to augment an otherwise heavily Java-centric IT strategy with a Web application layer that provides a higher level of developer productivity; integration with Java is particularly tight since ColdFusion applications are literally compiled into Java code for runtime execution

• You need to augment an otherwise heavily .NET-centric IT strategy with a platform that can be deployed to Linux and Unix, while retaining tight connectivity and integration with the Microsoft technology ecosystem

• You need to integrate Web applications with online Adobe Forms, or provide back-end processing to Flex and Air RIAs"

When is a form too long and too slow?

I have a form that is longer than one page (and it can be slow depending on what is submitted)

Would it be acceptable design to have a submit button that became disabled (while waiting for the server to respond) with a progress bar inside the button?

use your favourite style changer here

If your url has variables like action=takeAction then adding checkurl() to the onload of the body tag of your page can change the style of the link that got your user there if its id happens to be (in this case) takeAction

It works like a:visited except its only the most recently clicked link.

function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
    return "";
else
    return results[1];
}
function checkurl() {
var ref = gup('action').toLowerCase();
if (ref) {
    var a = document.getElementById(ref);
    if(a) {
     YAHOO.util.Dom.setStyle(a,'color','#0065b3');
//use your favourite style changer here
        }
    }
}

begone spambots

For a few weeks I had this blog hosted at godaddy.com but the changes needed to Ray C's code to get around godaddy's restrictions (like no createObject(), no cfdump etc) just kept growing so I cut my losses and moved here to www.hostek.com

Its just as cheap, its CF8 and there are no restrictions.

my bugs fix themselves

I had a problem with the code that runs this blog. I presumed it was caused by the hosts setup.

I left it broken (by commenting out a line) It worked again if I added 'reinit' equals whatever to the url.

Now its working again and I didnt do anything :-)

But changing settings in the admin settings page does not work (I try setting captcha on)

BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner