Rate this article

Pop Up warning before leaving a page

Rating: 4.8/5 (5 votes cast)

We sometimes need to have a pop-up warning message displayed before redirecting to a different page.

This is especially handy when you are updating a record and the user needs to do something on a different page, before he / she can continue.

I am always forgetting the syntax, so I am adding it here for my own reference. (And everyone else's.)

Lets say you have a graphic link like this:

<a href="gallery_list.php"><img src="../back/images/add2.png" alt="Add Gallery" width="16" height="16" border="0"></a>

To add the pop-up warning change the link to this.

<a href="gallery_list.php" onclick="return confirm('<?php echo NXT_getResource("Are you sure?"); ?>');"><img src="../back/images/add2.png" alt="Add Gallery" width="16" height="16" border="0"></a>

Obviously you can change the confirm('message') to whatever you like.
Leaving the NXT_getResourse... message, your site will automatically make use of the build-in multilingual support if you use it.


Adobe

Free PositiveSSL and WhoisGuard with Every Domain Purchase
XMS Systems
ionCube Online PHP Encoder

Although we try to ensure all the articles submitted are valid it is your responsibility to make sure you have backups before you use these suggestions on your pc or websites.
We do not take any responsibility for any data-loss, loss in functionality or any problem that might arise in what-ever way or form by making use of the information on this site.

"Friends of Interakt" has no connection to the Adobe Interakt Company