Link to home
Start Free TrialLog in
Avatar of adam1h
adam1hFlag for Belgium

asked on

coldfusion syntax error

Hi experts,

I have a syntax error in these code but I can't see where.

The error shown is :
Invalid CFML construct found on line 341 at column 23.
ColdFusion was looking at the following text:
;

		<!--- get form's data & store into pages (cfc's) --->
		<cfloop list="#variables.languages#" index="variables.lang">
			<!--- get & store default language's data --->
			<cfif variables.lang EQ application.languageByDefault>
				<!--- title --->
				<cfset variables["cfc_" & variables.lang].setTitle(evaluate('form.title_#application.languages["#variables.lang#"]#'))>
				<cfset variables.defaultTitle = evaluate('form.title_#application.languages["#variables.lang#"]#')>
				<!--- description --->
				<cfset variables["cfc_" & variables.lang].setDescription(evaluate('form.description_#application.languages["#variables.lang#"]#'))>
				<cfset variables.defaultDescription = evaluate('form.title_#application.languages["#variables.lang#"]#')>
				<!--- keywords --->
				<cfset variables["cfc_" & variables.lang].setKeywords(evaluate('form.keywords_#application.languages["#variables.lang#"]#'))>
				<cfset variables.defaultKeywords = evaluate('form.title_#application.languages["#variables.lang#"]#')>
				<!--- page's body --->
				<cfset variables["cfc_" & variables.lang].setBody(evaluate('form.body_#application.languages["#variables.lang#"]#'))>
				<cfset variables.defaultBody = evaluate('form.title_#application.languages["#variables.lang#"]#')>
				<!--- save data to the database --->
				<cfset entitySave(evaluate('variables.cfc_#variables.lang#'))>
				<cfset ormFlush()>
				<cfbreak>
			</cfif>
		</cfloop>

Open in new window



the line 341 is the line below
<!--- title --->
:
		<cfloop list="#variables.languages#" index="variables.lang">
			<!--- get & store other language's data --->
			<cfif variables.lang NEQ application.languageByDefault>
				<!--- title --->
				<cfset variables.valueToTest = evaluate('form.title_#application.languages["#variables.lang#"]#')>
				<cfif variables.valueToTest NEQ "">
					<cfset variables["cfc_" & variables.lang].setTitle(evaluate('form.title_#application.languages["#variables.lang#"]#'))>
				<cfelse> <!--- this language's value is empty : store default language's value --->
					<cfset variables["cfc_" & variables.lang].setTitle(variables.defaultTitle)>
				</cfif>
				<!--- description --->
				<cfset variables.valueToTest = evaluate('form.description_#application.languages["#variables.lang#"]#')>
				<cfif variables.valueToTest NEQ "">
					<cfset variables["cfc_" & variables.lang].setDescription(evaluate('form.description_#application.languages["#variables.lang#"]#'))>
				<cfelse> <!--- this language's value is empty : store default language's value --->
					<cfset variables["cfc_" & variables.lang].setDescription(variables.defaultDescription)>
				</cfif>
				<!--- keywords --->
				<cfset variables.valueToTest = evaluate('form.keywords_#application.languages["#variables.lang#"]#')>
				<cfif variables.valueToTest NEQ "">
					<cfset variables["cfc_" & variables.lang].setKeywords(evaluate('form.keywords_#application.languages["#variables.lang#"]#'))>
				<cfelse> <!--- this language's value is empty : store default language's value --->
					<cfset variables["cfc_" & variables.lang].setKeywords(variables.defaultKeywords)>
				</cfif>
				<!--- page's body --->
				<cfset variables.valueToTest = evaluate('form.body_#application.languages["#variables.lang#"]#')>
				<cfif variables.valueToTest NEQ "">
					<cfset variables["cfc_" & variables.lang].setBody(evaluate('form.body_#application.languages["#variables.lang#"]#'))>
				<cfelse> <!--- this language's value is empty : store default language's value --->
					<cfset variables["cfc_" & variables.lang].setBody(variables.defaultBody)>
				</cfif>
				<!--- save data to the database --->
				<cfset entitySave(evaluate('variables.cfc_#variables.lang#'))>
				<cfset ormFlush()>
			</cfif>
		</cfloop>

Open in new window


Do you have an idea ?
Avatar of _agx_
_agx_
Flag of United States of America image

Don't trust error messages 100%.  Sometimes the error line # is way past the actual problem. It's just where the compiler gave up.

I don't see any semi-colons ";" in that code.  Are there any semi-colon's in the sections leading up to that line?

Complete shot in the dark, but sometimes I get that error when converting cfscript to cfml and forget to change the closing mark from ";" to ">", causing that error  ie

                  <cfset b = 123;              <=== invalid
                  <cfset b = 123>             <=== valid
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adam1h

ASKER

Hi both,

No I haven't any ; in my code.

Us I will try to rewrite & simplify

We'll see
Yeah, I'd agree you should refactor. I'd rollback the "bad" changes and start with a last know "good" copy. Go from there.