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.
ColdFusion Language

Avatar of undefined
Last Comment
vasquezm

8/22/2022 - Mon
Pravin Asar

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
SidFishes

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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!
Your help has saved me hundreds of hours of internet surfing.
fblack61