Skip to main content
jbird5k
Inspiring
June 8, 2010
Answered

CFLOOP ERROR "CONTEXT VALIDATION ERROR ...

  • June 8, 2010
  • 2 replies
  • 2913 views

I am getting an error for a cfloop tag that makes no sense.  CONTEXT VALIDATION ERROR FOR TAG CFLOOP  need a closing cfloop tag.

the problem is that I have paired up all tags each open tag has a closing tag. There is a nested table in the page that contains some other loops all tags are paired. I delete the table and the page runs fine. So I am confused as to what is causing the error.

The abrieviated code is below:

<!--- loop through unique people id's --->
<cfoutput>
<cfloop query="getIP_peopleItems">L1-o  <----- I GET AN ERROR SAYING THIS CFLOOP TAG IS NOT CLOSED
                                            "Context validation error for tag cfloop"

<!--- other code goes here  and is working--->

   
        <tr  bgcolor="##DBDBDB">
            <th colspan="8">Other</th>
   
        </tr>
        <tr>
        <td colspan="8">
       
        <!--- IF I REMOVE THE NESTED TABLE BELOW IN ITS ENTIRETY  I DO NOT GET THE ERROR.
                IF I COMMENT OUT SECTIONS OF THE TABLE , I GET THE " CONTEXT VALIDATION ERROR FOR TAG CFLOOP" --->
               
               
            <table  align="center" width="100%" border='1' cellpadding='5' cellspacing='0'summary="list of other personal property">T2-O
            <tr bgcolor="##c0c0c0">
                <th scope='col'>#</th><th scope='col'>Item</th><th scope='col'>Serial Number</th><th scope='col'>OIG Bar Code</th><th scope='col'>Action</th>
            </tr>
            <!--- insert  other personal propert items  --->
            <cfloop query="getIP_response">L2-O
             
                <cfif question_id EQ 2416 and response is not ''>I1-O
                  <cfset  rep = #response#>
                   <cfloop list="#rep#" index="i" delimiters="#chr(13)#">L3-O
                    <tr>
                        <td></td>
                     <cfloop list="#i#" index="j" delimiters="|">L4-O
                        <td>#j#</td>
                      </cfloop> L4-C
                    </tr>
                  </cfloop>L3-C
                  <cfelseif question_id EQ 2416 and response is ''>
                  <div align="center"> <span class="NoData">No Data Found</span></div>
                </cfif>I1-C
            
            </cfloop>L2-C
            </table>T2-C   
    </td></tr>   
        <tr  bgcolor="##DBDBDB">
            <th   colspan="8">Notes</th>
   
        </tr>
        <tr>
            <td colspan="8"> <br><br></td>
   
        </tr>   
    </table>
<br><br>

<hr>
</cfloop>L1 -C  <-- THIS CLOSES THE LOOP TAG AT THE TOP OF THE PAGE.
</cfoutput>

Anyone have any ideas what is causing the error.  I use this same layout in several different reports with no issues.

    This topic has been closed for replies.
    Correct answer Adam Cameron.
    <th scope='col'>#</th>


    What's wrong with this picture, in the middle of a CFM template?

    --

    Adam

    2 replies

    Adam Cameron.Correct answer
    Inspiring
    June 8, 2010
    <th scope='col'>#</th>


    What's wrong with this picture, in the middle of a CFM template?

    --

    Adam

    ilssac
    Inspiring
    June 8, 2010

    Ya know, I looked and looked and I could not see that.

    Even after you pointed it out, it took a good couple of minutes for me to see it!

    Sometimes ya just gotta get the right set of eyes to look at the code! 

    Inspiring
    June 8, 2010

    Ya know, I looked and looked and I could not see that.

    Even after you pointed it out, it took a good couple of minutes for me to see it!

    Sometimes ya just gotta get the right set of eyes to look at the code! 

    Well one of the good things about CFB I guess is that it just highlighted the line for me and said "well that ain't gonna work".

    --

    Adam

    ilssac
    Inspiring
    June 8, 2010

    This error can also happend from a unmatched or unescaped # sign.  If you have a single # character without a matching # at the end of a variable, ColdFusion thinks all the code after it is a malformed variable and does not see the closing tag as a tag.

    I think the samething can happen with unmatched quotes, either single or double.