Tag Archives: coldfusion

Coldfusion Cfform bug/error: “_b is undefined”

While coding a HTML form using Coldfusion’s CFForm, I encountered a bug that threw a javascript error while submitting it.

"_b is undefined" from cfform.js

around line 3:

_CF_hasValue=function(_b,_c,_d){
if(_c=="TEXT"||_c=="FILE"||_c=="PASSWORD"||_c=="CFTEXTAREA"||_c=="TEXTAREA"||_c=="CFTEXTINPUT"||_c=="DATEFIELD"){
if(_b.value.length==0){
return false; 
}else{
if(_d){
str=_b.value.replace(/^\s+/,"").replace(/\s+$/,"");
if(str.length==0){
return false;
}
} 

One of the problems with errors while submission is that it happens very quickly and the browser redirects. So the user doesn’t see the javascript error. It also breaks execution of any (onsubmit/event) javascript code.

I went through my cfform to find any problems code. However at the end, I noticed that the cfform tag was missing the “name” attribute, and by simply adding the “name” attribute I was able to avoid the error.

This is one of the reasons I do not like ColdFusion’s helpers, because the errors that they sometimes generate are very misleading and not documented.

Coldfusion solution to Oracle’s “string literal too long” (4k chars limit)

Working on a Coldfusion app with Oracle database, I wanted to import large amounts of data into “CLOB” fields (capable of handing GBs of data). I tried using SQL Developer (by Oracle) and another user tried SQL Loader, but we were both getting the same error on the INSERT statement:

ORA-01704: string literal too long
Cause: The string literal is longer than 4000 characters.
Action: Use a string literal of at most 4000 characters. Longer values may only be entered using bind variables.

We searched online and noticed that the fix to this problem required bind variables and/or creating a procedure, etc. Really a roadblock if you’re not familiar with PL/SQL and Oracle.

But the problem could be solved using Coldfusion’s JDBC connector to Oracle. I simply wrote up the following cfml code, and noticed that the cfsqltype=”cf_sql_clob” takes care of this 4000 (4k) chars limit problem.

Code:

<cfquery datasource="dsn" username="user" password="pass">
	INSERT INTO logs_table VALUES (
		1,
		<cfqueryparam value="TEST" cfsqltype="cf_sql_varchar">,
		<cfqueryparam value="HUGE AMOUNT OF TEXT HERE (use cfsavecontent and output here)" cfsqltype="cf_sql_clob">
	)
</cfquery>

Coldfusion 9 to 9.0.1 Update Error: “Variable ENABLEIMPLICITUDFREGISTRATION is undefined.” or Data Source page blank

If you see the following error in Coldfusion Administrator -> Server Settings -> Settings:
Variable ENABLEIMPLICITUDFREGISTRATION is undefined.

Or, when trying to add a Data Source, such as Microsoft Access (with Unicode), you see a blank page.

This is most likely because you have upgraded from a previous CF9 installation to either CF 9.0.1 or the CHF1 (hotfix 1 for 9.0.0 and 9.0.1). Sometimes you think you haven’t done an upgrade, but during the install process, pay particular attention, the CF9 Installer goes through a migration process, make sure to skip that.

It is actually easy to port over old settings by manually copying from one CF Admin panel to another, rather than try to figure out how to fix this bug. I’d like to add: there is no known fix, it is an open issue in CF Bug Tracker.