Solved

Browser back button refreshing coldfusion iframe

Posted on 2016-07-19
6
79 Views
Last Modified: 2016-07-20
I have a page that uses ajax to call an iframe.  The iframe source is a Coldfusion form.  Once I complete the form, if someone navigates to another page and then uses the back button the form submission happens again.

I can't use session variables and cookies, so what can I do?
0
Comment
Question by:trifecta2k
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 41720129
After the form action processes, do you use a CFLOCATION at the end of the action code to redirect the page?   If you don't try adding it.
0
 
LVL 5

Author Comment

by:trifecta2k
ID: 41720166
I don't think I'm following your suggestion.  When the iframe form completes, it puts a message in the iframe.  To leave the page, a user has to click the menu options on the parent page. Then when they hit back it submits the form again.  The iframe is a framework/1 page.  So it uses controllers, services, etc. Unfortunately, I just started using fw/1 and I'm not super familiar with it.
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 41721011
Look at the code that runs when the form is submitted.   It probably does some database saves or something like that.   The last line of that code should be a CFLOCATION.   CFLOCATION will do a server-side redirect to a new page.   That new page can show the message.   Using this method prevents a new form submit when hitting the back button.
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 5

Author Comment

by:trifecta2k
ID: 41721161
Since it's fw/1 it uses framework.setView(the view), I changed it to framework.redirect(the view) and it works. There a few minor tweaks, but it worked!

Thanks.
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 41721201
Glad it works.   I have learned to advocate against frameworks.   Every year there is a new framework and that renders previous frameworks outdated very quickly.  Try to find someone that knows the dozens of frameworks that are now out of popularity; some of them are far too complex.  They add an unnecessary learning curve and rarely much benefit.  IMHO.
0
 
LVL 5

Author Comment

by:trifecta2k
ID: 41721537
I agree.  I'm not a huge fan of frameworks either.  Thanks again for your help.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question