Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Invalid CFML construct error -- cfscript

New Here ,
Jul 27, 2009 Jul 27, 2009

I'm having a hard time figuring out the root of this error.  Everything looks fine to me, and I've tried several different things...

Invalid CFML construct found on line 40 at column 22.

ColdFusion was looking at the following text:  Invalid

The function is (line 40 is highlighted in blue)....

<cfscript>

function isValidAddress( address1, address2 )

{

    if( Len(address1) )

    {
        return "Invalid Address empty string passed for address line 1.";
    }
 

   ...

   ...

}

I've also tried created a string, and setting that string in the body of the if statement instead of returning.

....

var resultStr = "";

if( Len(address1) )

{

   resultStr = "Invalid Address. Empty string passed for address line 1.";

}

...

return resultStr;

But I still receive the same error.  Any help??  Thanks in advance!!

9.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jul 27, 2009 Jul 27, 2009

Any other code before that line?

This type of error is often caused by a earlier line not closing a set of quotes, hash markers, or parentheses.

Then when CF finally gets the quote in your "invalid.... it closes the previous quotes and then has no idea what to do with this "invalid" command it is trying to parse.

Translate
Valorous Hero ,
Jul 27, 2009 Jul 27, 2009

Any other code before that line?

This type of error is often caused by a earlier line not closing a set of quotes, hash markers, or parentheses.

Then when CF finally gets the quote in your "invalid.... it closes the previous quotes and then has no idea what to do with this "invalid" command it is trying to parse.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 27, 2009 Jul 27, 2009

Yep. That's exactly what it was, an extra double-quote after a semicolon in the previous block of code.  Thanks for the heads-up of what to look for when I see this error!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2009 Jul 27, 2009
LATEST

[Please ignore - crossed your earlier reactions in the post]

I get no problem with

<cfscript>
function isValidAddress( address1, address2 )
{
    if( Len(address1) )

    {
        return "Invalid Address empty string passed for address line 1.";
    }

}
</cfscript>

<cfoutput>#isValidAddress('test')#</cfoutput>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources