Link to home
Get AccessLog in
Avatar of vasquezm
vasquezm

asked on

Print Results After Post

I have a Coldfusion Search page that posts to itself, when complete cfgrid displays the results of the post based upon a bind to a CFC from the form scope.

Because of the Search criteria being used and the amount of data, I want to provide the user with the ability to print the results after they have verified that the information is correct.  

I have duplicated the form scope to the request scope after post.

The problem I am having is passing the form scope or request scope variables to another page for processing to a Coldfusion Report for printing.  The scoped variables do not remain.

The provide additional detail, I used a variable in the action page for the form, on the first submit it posts to itself.  After post the action page is another page print_results.cfm which I want to take the scoped variables, pass to a cfc using cfinvoke and then the results passed to a ColdFusion Report.

General code would help greatly as I need to understand how to retain and pass the scope.  not sure if or how the form scope needs to be sent to a cfc to retain to the new action page.
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

Simple way is use cfdump (but not useful in application)

<cfdump var=”#form#”>

Within an application, you can loop over a collection that is created when a form is submitted. That collection contains the form field names, and you can use those field names to reference the values that exist in the fields.

<cfloop item="fname" collection="#form#">
<cfoutput>#fname# - #form[fname]#<br></cfoutput>
</cfloop>

This code simply displays the fields and their values, but you can use the information to do a database insert or manipulate the corresponding data however you like.

There is also a list created of the fieldnames as an attribute of the form collection that you can access by referencing form.fieldnames:

<cfloop item="fname" list="#form.fieldname#">
<cfoutput>#fname# - #form[fname]#<br></cfoutput>
</cfloop>
ASKER CERTIFIED SOLUTION
Avatar of SidFishes
SidFishes
Flag of Canada image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of vasquezm
vasquezm

ASKER

I was able to keep within the session scope, and prior to the print I drop the session vars to make sure that it does not persist for the next search / print.  

Now off to the easy part, option to send to excel.

Thanks everyone for the help!