最新分享

How can I show a Thanks Message then redirect the user?

Add a Custom Code action to the On Submit action of your form and add this code to it.
<?php
$doc = \JFactory::getDocument();
$doc->setMetaData('refresh', '5;url=http://example.com/index.php', 'true');
?>
Edit the highlighted parts of the code to set the number of seconds to delay and the URL to redirect the user to.

Variable redirection

If you want to use a variable URL - to redirect the user to different pages depending on the form results then you can set a URL using the ReDirect URL action and then use this version of the code in the Custom Code action.
<?php
$doc = \JFactory::getDocument();
$doc->setMetaData('refresh', '5;url='.$form->data['redirect_url'].'', 'true');
?>

Avoid the Joomla! bug

This version is less elegant but avoids the charset bug.
<?php
$doc = \JFactory::getDocument();
$doc->addCustomTag('<meta http-equiv="refresh" content="5;url=http://example.com/index.php" />');
?>
 
Last modified on April 22, 2016
UFO

信念是心中的火花,永远别让它熄灭!

Website: iplantoo.com
Login to post comments