Solved

Browser back button refreshing coldfusion iframe

Posted on 2016-07-19
6
75 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 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