I have put this code in "custom code." The form submits but goes to a blank page (url reads along the lines of "chronoforms form submit"). However the site stays in the correct language so the language side of the script is working but it's not redirecting."> Multilingual redirect to url - Forums

Forums

Multilingual redirect to url

Gareth 14 Nov, 2015
Hi,

My problem is redirecting a submitted multilingual form. I have already searched this forum which has helped me along a bit
<?php
$rows[0]->redirecturl = $url;
$lang =& JFactory::getLanguage();
switch ( $lang->getName() ) {
  case 'fr-FR':
default:
    $url  = "http://www.mysite.com/fr/merci";
  break;
    case 'en-EN':
      $url = "http://www.mysite.com/en/thankyou";
  break;
}
?>
I have put this code in "custom code." The form submits but goes to a blank page (url reads along the lines of "chronoforms form submit"). However the site stays in the correct language so the language side of the script is working but it's not redirecting.
GreyHead 14 Nov, 2015
Hi Gareth,

You could just add code like this to a Custom Code action and let ChronoForms display it.

If you want to redirect I'd use the Joomla! method here
<?php
$rows[0]->redirecturl = $url;
$lang =& JFactory::getLanguage();
switch ( $lang->getName() ) {
  case 'fr-FR':
  default:
    $url  = "http://www.mysite.com/fr/merci";
    break;
  case 'en-EN':
    $url = "http://www.mysite.com/en/thankyou";
    break;
}
$app = \JFactory::getApplication();
$app->redirect($url);
?>

Bob
Gareth 15 Nov, 2015
Hi Bob,

Many thanks for the rapid response and helping me get the redirect working!!
This topic is locked and no more replies can be posted.