From: crendering on
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>


From: GArlington on
On Apr 3, 7:24 am, "crendering" <webforumsu...(a)macromedia.com> wrote:
> 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

Apparently "we might know that "javascript doesn't work inside a
cfdocument tag", but some of us do not know what it means...
javascript run on the client ONLY, i.e. AFTER CF finished generating
the complete page (whichever format - html OR pdf).
That means that you CAN NOT run javascript function AND let CF process
the result, by the time javascript runs the CF is DONE, finished,
resting, inactive...

> 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>

From: Dan Bracuk on
javascript runs on the client after cold fusion has done what it has to do. move your getHeight function to cold fusion.
From: Adam Cameron on
> document.write('<cfdocumentitem type = "pagebreak" />');

I don't think you ought to expect the CF server to know about CFML that's
being output on the client browser... ;-)

have a read of my response to this thread - <http://tinyurl.com/2e3lwn>
<http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=3&threadid=812773&arctab=arc>
- for an explanation as to how CF and the client application play with each
other.

--
Adam
From: crendering on
Move my height to coldfusion??? How can coldfusion pre-determine the height value when the table hasn't been process? Could you provide an example of moving my height to coldfusion?