rrattie
asked on
Context validation error for tag cfif outputting to an XML file.
I'm getting the following error when trying to output to an XML file.
Error Occurred While Processing Request
Context validation error for tag cfif.
The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfif>. If the body of the tag is empty you can use the shortcut <cfif .../>.
The CFML compiler was processing:
The body of a cfoutput tag beginning on line 118, column 20.
The error occurred in E:\intranet\cf_portal\Serv iceResults .cfm: line 135
133 : <dollar> $#trim(Form.txtDollar)#</d ollar>
134 : <recommendedvendor>
135 : <cfif #Form.recVendorName# EQ "">
136 : <cfelseif (IsDefined ("Form.recVendorName"))>
137 : <recvendorname> #trim(FORM.recVendorName)# </recvendo rname>
The code in question is below. Any thoughts? The end cfif tag is plainly visible.. what am I missing?
Error Occurred While Processing Request
Context validation error for tag cfif.
The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfif>. If the body of the tag is empty you can use the shortcut <cfif .../>.
The CFML compiler was processing:
The body of a cfoutput tag beginning on line 118, column 20.
The error occurred in E:\intranet\cf_portal\Serv
133 : <dollar> $#trim(Form.txtDollar)#</d
134 : <recommendedvendor>
135 : <cfif #Form.recVendorName# EQ "">
136 : <cfelseif (IsDefined ("Form.recVendorName"))>
137 : <recvendorname> #trim(FORM.recVendorName)#
The code in question is below. Any thoughts? The end cfif tag is plainly visible.. what am I missing?
<recommendedvendor>
<cfif #Form.recVendorName# EQ "">
<cfelseif (IsDefined ("Form.recVendorName"))>
<recvendorname> #trim(FORM.recVendorName)#</recvendorname>
<revdendorpoc>#trim(FORM.recVendorPOC)#</revdendorpoc>
<recvendoremail>#trim(FORM.recVendorEmail)#</recvendoremail>
<recvendorphone>#trim(FORM.recVendorPhone)#</recvendorphone>
<recvendoraddress>#trim(FORM.recVendorAddress)# #trim(FORM.recVendorAddressCity)#,#trim(FORM.recVendorAddressState)# #trim(FORM.recVendorAddressZipcode)#</recvendoraddress>
<cfelseif #Form.recVendorName2# EQ "">
<cfelseif (IsDefined ("Form.recVendorName2"))>
<recvendorname2> #trim(FORM.recVendorName2)#</recvendorname2>
<revdendorpoc2>#trim(FORM.recVendorPOC2)#</revdendorpoc2>
<recvendoremail2>#trim(FORM.recVendorEmail2)#</recvendoremail2>
<recvendorphone2>trim(FORM.recVendorPhone2)#</recvendorphone2>
<recvendoraddress2>#trim(FORM.recVendorAddress2)# #trim(FORM.recVendorAddressCity2)#,#trim(FORM.recVendorAddressState2)# #trim(FORM.recVendorAddressZipcode2)#</recvendoraddress2>
<cfelseif #Form.recVendorName3# EQ "">
<cfelse>
<recvendorname3> #trim(FORM.recVendorName3)#</recvendorname3>
<revdendorpoc3>#trim(FORM.recVendorPOC3)#</revdendorpoc3>
<recvendoremail3>#trim(FORM.recVendorEmail3)#</recvendoremail3>
<recvendorphone3>#trim(FORM.recVendorPhone3)#</recvendorphone3>
<recvendoraddress3>#trim(FORM.recVendorAddress3)# #trim(FORM.recVendorAddressCity3)#,#trim(FORM.recVendorAddressState3)# #trim(FORM.recVendorAddressZipcode3)#</recvendoraddress3>
</cfif>
</recommendedvendor>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
good eyes, Tomarse111! but i doubt that missing # is the culprit: cf checks the code top-down, and since it broke on line 135 (or line 2 in posted snippet), it has not reached the missing # yet...
Azadi
Azadi
I'm 99% sure that the missing # is the problem. Just tested it on a fake form submission with and without and it comes up with the same error and then fixes it.
Also point taken about his code not making sense. Please see attached:
Also point taken about his code not making sense. Please see attached:
<recommendedvendor>
<cfif IsDefined ("Form.recVendorName") AND Form.recVendorName NEQ "">
<recvendorname> #trim(FORM.recVendorName)#</recvendorname>
<revdendorpoc>#trim(FORM.recVendorPOC)#</revdendorpoc>
<recvendoremail>#trim(FORM.recVendorEmail)#</recvendoremail>
<recvendorphone>#trim(FORM.recVendorPhone)#</recvendorphone>
<recvendoraddress>#trim(FORM.recVendorAddress)# #trim(FORM.recVendorAddressCity)#,#trim(FORM.recVendorAddressState)# #trim(FORM.recVendorAddressZipcode)#</recvendoraddress>
</cfif>
<cfif IsDefined ("Form.recVendorName2") AND Form.recVendorName2 NEQ "">
<recvendorname2> #trim(FORM.recVendorName2)#</recvendorname2>
<revdendorpoc2>#trim(FORM.recVendorPOC2)#</revdendorpoc2>
<recvendoremail2>#trim(FORM.recVendorEmail2)#</recvendoremail2>
<recvendorphone2>#trim(FORM.recVendorPhone2)#</recvendorphone2>
<recvendoraddress2>#trim(FORM.recVendorAddress2)# #trim(FORM.recVendorAddressCity2)#,#trim(FORM.recVendorAddressState2)# #trim(FORM.recVendorAddressZipcode2)#</recvendoraddress2>
</cfif>
<cfif IsDefined ("Form.recVendorName3") AND Form.recVendorName3 NEQ "">
<recvendorname3> #trim(FORM.recVendorName3)#</recvendorname3>
<revdendorpoc3>#trim(FORM.recVendorPOC3)#</revdendorpoc3>
<recvendoremail3>#trim(FORM.recVendorEmail3)#</recvendoremail3>
<recvendorphone3>#trim(FORM.recVendorPhone3)#</recvendorphone3>
<recvendoraddress3>#trim(FORM.recVendorAddress3)# #trim(FORM.recVendorAddressCity3)#,#trim(FORM.recVendorAddressState3)# #trim(FORM.recVendorAddressZipcode3)#</recvendoraddress3>
</cfif>
</recommendedvendor>
ASKER
Can't believe I missed that! : )
You rock!
You rock!
good job, Tomarse111 - i have just tested it too and you are right - the missing # is the problem! points well earned.
Azadi
Azadi
but on a non-related subject: what sort of code is:
<cfif #Form.recVendorName# EQ "">
<cfelseif (IsDefined ("Form.recVendorName"))>
and the rest of <cfelseif> blocks in your posted snippet???
this code makes NO sense at all:
if Form.recVendorName is an empty string it IS already defined - no point checking for isdefined("Form.recVendorN
Azadi