Question
javascript var for cf tag to read
I'm having trouble getting coldfusion to read my javascript
output for coldfusion to process.
I am generating a list of records based on a query. Every record is written inside a table. Each table's height is undetermined until the data is generated. However, I get this number (each table's height) by calling a javascript function. My goal is to output a pdf page that is generated dynamically based on a query to print without a record spilling onto the next page. This I can accomplish by placing <cfdocumentitem type=pagebreak> at appropiate places. However, when I call my javascript function to write a cfdocumentitem tag, coldfusion throws an error alerting that this tag needs to be inside a cfdocument tag. Now we all know that javascript doesn't work inside a cfdocumet tag which is why I am placing it outside of these tags, saving it to cfsavecontent tag and loading this inside the cfdocument tag. I tried replacing the <> (opening and closing angle brackets) with < and > and it bypasses coldfusion's error page but then coldfusion doesn't process my cfdocument tag.
Below is just my javascript code to simplify my code. I can provide the rest if necessary.
Can anybody help?
Cesar
-------------------------------------------------------------------------------
<script language="JavaScript" type="text/javascript">
<!--
function getHeight(table)
{
var myHeight = window.document.getElementById(table).offsetHeight;
if (myHeight == 136) {
document.write('<cfdocumentitem type = "pagebreak" />');
}
}
//-->
</script>
I am generating a list of records based on a query. Every record is written inside a table. Each table's height is undetermined until the data is generated. However, I get this number (each table's height) by calling a javascript function. My goal is to output a pdf page that is generated dynamically based on a query to print without a record spilling onto the next page. This I can accomplish by placing <cfdocumentitem type=pagebreak> at appropiate places. However, when I call my javascript function to write a cfdocumentitem tag, coldfusion throws an error alerting that this tag needs to be inside a cfdocument tag. Now we all know that javascript doesn't work inside a cfdocumet tag which is why I am placing it outside of these tags, saving it to cfsavecontent tag and loading this inside the cfdocument tag. I tried replacing the <> (opening and closing angle brackets) with < and > and it bypasses coldfusion's error page but then coldfusion doesn't process my cfdocument tag.
Below is just my javascript code to simplify my code. I can provide the rest if necessary.
Can anybody help?
Cesar
-------------------------------------------------------------------------------
<script language="JavaScript" type="text/javascript">
<!--
function getHeight(table)
{
var myHeight = window.document.getElementById(table).offsetHeight;
if (myHeight == 136) {
document.write('<cfdocumentitem type = "pagebreak" />');
}
}
//-->
</script>
