• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • Last Modified:

Browser back button refreshing coldfusion iframe

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
trifecta2k
Asked:
trifecta2k
  • 3
  • 3
1 Solution
 
gdemariaCommented:
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
 
trifecta2kAuthor Commented:
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
 
gdemariaCommented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
trifecta2kAuthor Commented:
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
 
gdemariaCommented:
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
 
trifecta2kAuthor Commented:
I agree.  I'm not a huge fan of frameworks either.  Thanks again for your help.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now