Skip to main content
Participant
January 2, 2015
Question

dynamic cflayoutareas based on a recordset from cfquery - coldfusion version 9

  • January 2, 2015
  • 1 reply
  • 220 views

cflayout type="tab" name="mainTab" >

<cfloop query="qgetdcfg">

    <!--- Each layoutarea is one tab. --->

    <cflayoutarea title="#qgetdcfg.dsource#-#qgetdcfg.djobnamespec#"

       name="#qgetdcfg.dsource#-#qgetdcfg.djobnamespec#"

   selected = "true"

   >

    <h2>Tab name</h2>

    <p>

  <cfset datasource = "#qgetdcfg.dsource#">

  <cfset duser = "#qgetdcfg.duser#">

  <cfset dpassword = "#qgetdcfg.dpassword#">

  <cfset djobnamespec = "#qgetdcfg.djobnamespec#">

  <cfinclude template=all_js.cfm>

    </p>

    </cflayoutarea>

</cfloop>

</cflayout>

The above almost works. The all_js.cfm has only two parts to it, it formats a pie chart and then displays a few rows of data based on the datasource, user and password and djobnamespec variables.

The two tab shows up. The two charts show up in the appropriate table, but the data-table- rows - are always on the first tab. They do not follow the chart that is on the second tab. Are there any restrictions on cfinclude with cflayoutarea.

The contents of all_js.cfm is similar to what is enclosed below.

<cfquery name="qsummary" datasource="#datasource#" username="#duser#" password="#dpassword#">

select STATUS, cnt from stab

</cfquery>

<cfchart style="blue" showborder="yes" show3d="yes" chartwidth="250"

chartheight="250"  pieslicestyle="sliced">

    <cfchartseries type="pie"  query="qsummary" 

itemcolumn="STATUS"  valuecolumn="cnt">

    </cfchartseries>

</cfchart>

<cfquery name="qall_jstatus" datasource="#datasource#" username="#duser#" password="#dpassword#">

select col1, col2 from table1

</cfquery>

<cfoutput query=”qall_jstatus>

<tr>

<td bgcolor=#color#>#qall_jstatus.col1#</td>

<td bgcolor=#color#>#qall_jstatus.col2#</td>

<cfform action=”kkkk.cfm” method=”post”>

            <input type="hidden" name="duser" value="#duser#">

            <input type="hidden" name="dpassword" value="#dpassword#">

</cfform>

</tr>

</cfoutput>

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    January 5, 2015

    You might require a <table> tag before the <cfoutput query=""> tag. It might be that the <tr> tags are stranded without the <table> tag.