Solved

Browser back button refreshing coldfusion iframe

Posted on 2016-07-19
6
71 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
3 Use Cases for Connected Systems

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

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
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)

912 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now