0

How can I use cflocation to open new tab?

I submit a form, then it should open a new tab and redirect the original page. Is it possible?

<cfform ACTION="./test.cfm" METHOD=POST>

Then in the test.cfm

    <!-- Some database update here -->

<!--- I would like to open it in new tab --->
<cflocation url="newTab.cfm" addtoken="false">

<!--- Then refirect the current page to new link --->
<cflocation url="redirect.cfm" addtoken="false">

Is it possible to be done?

Thanks

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Max Boy
  • 317
  • 6
  • 21

1 Answers1

4

The closest you can get is

<cfform ACTION="./test.cfm" METHOD=POST target="_blank"
    onsubmit="window.location('redirect.cfm')">

The user's browers might go into a new tab.

Per Dan

The rest of this equation is

onsubmit="window.location('redirect.cfm')" 
James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • Thanks... The problem is that I need to open a new tab with an URL and refresh/submit the form with another URL – Max Boy Jan 12 '18 at 20:22
  • 4
    Sound awfully convoluted. Maybe if you step back and look at the overall objective, you will think of an easier way to achieve it. – Dan Bracuk Jan 13 '18 at 02:30
  • 1
    As mentioned in earlier comments, those kind of actions require client side code - not server side (cflocation), but agreed it does sound convoluted... – SOS Jan 17 '18 at 16:20