Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8258209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:27:42+00:00 2026-06-08T02:27:42+00:00

I try to prevent a website of sending a form again after refreshing a

  • 0

I try to prevent a website of sending a form again after refreshing a website. The problem is, it should be possible, when turning back to previous side to change things and send email the email a second time.

When turning back, the form page won’t be loaded again and it is not possible to change a SESSION variable. But the user should still be able, to get his old data again and don’t has to type in everything again.

After using just the SESSION for setting variables, i used the CGI.HTTP_Referer to get the website the user came from. But when reloading the website, the referer doesn’t change. So no way to solve the problem that way.

<cfif Right("#CGI.HTTP_REFERER#", 5) EQ "myForm">
    <cfset SESSION.send = true />
<cfelse>    
    <cfset SESSION.send = false />
</cfif>

Is there a way to execute coldfusion code with javascript or any other way


WHAT I TRYED:

<cfif isDefined("SESSION.actualSite") EQ "false" 
AND isDefined("SESSION.actualSite") EQ "false">

        <cfset SESSION.lastSite = ArrayNew(1) />
        <cfset SESSION.actualSite = ArrayNew(1) />
        <cftrace var="SESSION.lastSite" text="lastSite1" />
        <cftrace var="SESSION.acutalSite" text="acutalSite1" />
    </cfif>

    <cfif ArrayisEmpty(SESSION.actualSite) EQ "NO">
        <cfoutput>#ArrayLen(SESSION.actualSite)#</cfoutput>
        <cfset SESSION.lastSite[1] = SESSION.actualSite[1] />
        <cfset SESSION.lastSite[2] = SESSION.actualSite[2] />

        <cfdump var="#SESSION#" label="session scope from application.cfm" /><br />

        <cfif SESSION.actualSite[1] NEQ SESSION.lastSite[1] >           
            <cfoutput>INSIDE TRUE BLOCK</cfoutput>
            <cfset SESSION.send = true />
        <cfelse>        
            <cfoutput>INSIDE FALSE BLOCK</cfoutput>
            <cfset SESSION.send = false />
        </cfif>
    </cfif> 

    <cfset SESSION.actualSite[1] = Right("#CGI.CF_TEMPLATE_PATH#", 25) />
    <cfset SESSION.actualSite[2] = Left("#Right("#CGI.HTTP_REFERER#", 25)#", 17) />

Looks to me, like the method with relocation to a blank page where you just display some output text is the easiest and best way. But I was looking for another way to solve this problem. In the previous code, I save the CGI variables, CF_TEMPLATE_PATH and HTTP_RERFERER inside arrays. On next refresh or when turning back to the form and submitting again, the array will be set again, and previous site information (from page before) will be moved to a second array. This must be executed inside the Application.cfm. I also defined the arrays in the SESSIOn scope… everything must be fine, but something doesn’t work. Maybe somebody can help me?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:27:45+00:00Added an answer on June 8, 2026 at 2:27 am

    This is how I dealt with “reload sending email again” situations on some of the sites I worked with.

    After the form is submitted and the email is sent, use cflocation to redirect to a simple html/cfm file that thanks them for the input. The user can reload that page and it will just redisplay the “thank you” message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i use below code - Just try again. - to prevent deadlock. it seems
I'll only try to present the main part of the problem, because the whole
(This is a question about a vague problem. I try to present all relevant
Possible Duplicate: What is the advantage of using try {} catch {} versus if
Hey I'm using Slimbox2 in a Website but after opening up the lightbox effect
I keep getting this when I try hit the link of a website I
I have this submit button on my website. <form name=bbsform action=<?=$PHP_SELF?> method=post <input type=submit
I'll try to present my problem clearly, but I'm bit of a novice in
I have a glaring CSS problem with my website on iphone even though it
I try to prevent page reload when user click a link, so I wrote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.