HTML/Cold Fusion report to open a file automaticaly when the next button is pushed after selecting either HTML or Excel output option.

I have a report that I need to run after selecting an HTML or Excel option then after hitting submit the report would run automatically and pull up the queried results from a sql query. I'm having issues getting the report to automatically run after hitting the next button. Below is the code I'm using to go to the next page:

												    <cfform name="form1" method="post" action="html.htm">
													
                                                   <tr>
                                                   <cfselect name="test">											  
                                                     <option name="html" type="radio" value="html">
                                                     HTML
                                                     </option>
                                                     <option name="excel" type="radio" value="excel">
                                                     Excel
                                                     </option>                                                  
                                                     </cfselect>
                                                   </tr>                                      
                                                      
                                                   <tr>
                                                      <td colspan="3" class="maintxt12">
                                                        <input type="submit" name="Next" value="Next">
                                                        <input type="reset" name="Reset" value="Reset">
                                                   </td>
                                                   </tr></cfform> 

Open in new window


The next should go to the query.cfm file and automatically run the query. I'm sure this is something simple but I'm missing something.

Thanks, for any assistance
QuackdeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gdemariaCommented:
Instead of having a next button, why don't you have a button for HTML and a button for Excel.

Alternatively, why not have the "Next" button simply say "Run"  and that submits the run.   What is on the next page?

Lastly, if you need to go to the next page, what does your form handling look like?   The submit for "Next" should run your report and take you to the next page after.
0
QuackdeveloperAuthor Commented:
I'm following a request to match a current report setup. That's how its currently setup. I could likely switch next to run without much push back as long as the page it goes to runs the query and outputs the report. I have the sql query setup...just need to set the output up correctly. I'm just trying to allow them to choose either an html or excel option from a drop down menu then select next/run and the next page will have the report output.
0
gdemariaCommented:
So when the user clicks the Next button, you want them to land on another page and then have an Excel / PDF file open automatically?

I guess the problem is, how do you execute a server side process by opening a page?   You don't or you shouldn't.   If they bookmark that page and return to it, should it try to run a report?   I don't think so.  

You need a button to run the report, so you can do one of these things...

1.  When the user clicks next, you can run and then save the report.  On the next page show a big button that says, your report is ready click here to open
2.  You can just open the report when the user clicks "Next" and then take the user to the next page that says "thanks for running a report"
3.  Don't do anything on the HTML/PDF selection page, when the user clicks next.  The next page shows a button that says.. "Run Report" and then run it there.
4. Change your "Next" button to a "Run" button and just run the report!
5. Change your "Excel" or "PDF" selection to two buttons instead.   "Open Excel"  or  "Open PDF" and when you click it, it runs the report and opens the correct format.

You want/need a button press to run the server side script.   There are lots of ways of doing it.  You can go to another page, before or after or stay on the same page.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

QuackdeveloperAuthor Commented:
ok...I'm able to use simple radio buttons now.

I have the first report working but the excel option I'm not sure how to set up. How do I trigger the selection to run the excel option when that radio button is clicked?  See the code below:

                                                   <form name="form1" method="post" action="23QueueStatusDetailRpt.cfm">
                                                   <tr>
												     <td width="32%" valign="middle" class="FormLabel12Blu">Select desired output format:</td>
                                                     <td width="13%" class="maintxt12">
                                                     <input name="type" type="radio" value="html" checked="checked"><span class="FormLabel12Blu">HTML</span></td>
                                                     <td width="55%" class="maintxt12">
                                                     <input name="type" type="radio" value="excel"><span class="FormLabel12Blu">MS Excel </span></td>
                                                   </tr>                                                         
                                                   <tr>
                                                      <td colspan="3" class="maintxt12">
                                                        <input type="submit" name="Run Report" value="Run Report">  

Open in new window


I need to open up the file named:  <form name="form1" method="post" action="23QueueStatusDetailRptEx.cfm"> when the excel button is selected.
0
gdemariaCommented:
There is no difference between radio buttons and select statement for the report.   As I mentioned, you could have made two buttons.   One to Run HTML and one to Run Excel.

In any case.  Change your action to a general file..

   <form name="form1" method="post" action="RunReport.cfm">   <!===== change your action
   <tr>
     <td width="32%" valign="middle" class="FormLabel12Blu">Select desired output format:</td>
     <td width="13%" class="maintxt12">
     <input name="type" type="radio" value="html" checked="checked"><span class="FormLabel12Blu">HTML</span></td>
     <td width="55%" class="maintxt12">
     <input name="type" type="radio" value="excel"><span class="FormLabel12Blu">MS Excel </span></td>
   </tr>                                                         

Open in new window


and in that file choose which file to run...

   File RunReport.cfm   <==== your new action =======

  <cfif form.type is "html">
     <cfinclude template="23QueueStatusDetailRptInHTML.cfm">
  <cfelseif form.type is "excel">  
     <cfinclude template="23QueueStatusDetailRpt.cfm">
  </cfif>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
QuackdeveloperAuthor Commented:
is it possible to run that within the first file?
0
gdemariaCommented:
Not sure what file is the "first file" but you can put that logical in whatever file you like, I suppose.   You can put it at the top of the file that has the submit (or Next) button and post the page to itself or you can put it at the top of existing form handling file.
0
QuackdeveloperAuthor Commented:
thanks...overthinking things as usual...appreciate the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.