Forums

Thank you page within article

jkdesign 03 Feb, 2011
Is it possible for the thank you page to be displayed within an article?

My form is here:
http://s315644355.onlinehome.us/site/index.php?option=com_content&view=article&id=111&Itemid=52

u: webdev
p: sewerweb

The form is placed within an article so that it is in the "who we are" section. When you submit the form (you can go ahead and submit it, it just goes to me), the thank you page is not within any section of the site, so in order to go view anything else they have to navigate back to the section they were in. Does this make sense? Ideally I would like the thank you to be within an article in the who we are section.
GreyHead 05 Feb, 2011
Hi jkdesign,

Here's one possible solution. It's a little roundabout but seems to work OK.

In the OnSubmit After Email box for your form put this code.
<?php
$url = JRequest::getVar('url', '', 'post');
$url = JURI::getInstance($url);
if ( $url->getVar('option') == 'com_chronocontact' ) {
  $url->delVar('task');
}
$url->setVar('tks', 'true');
$MyForm->setFormData('redirecturl', $url->toString());
?>

This sets the redirect URL for the form back to a URL passed in the form data and adds a little &tks=true to the URL.

Then in the Form HTML box add this code:
<?php
$url = JFactory::getURI();
if ( $url->getVar('tks') == 'true' ) {
  echo "Thanks";
  return;
} else {
 echo "<input type='hidden' name='url' id='url' value='".$url->toString()."' /> ";
}
?>

This checks for the &tks=true and if it finds it shows a 'Thanks' message (otherwise it shows the form and adds a hidden input with the current page url).

Bob
jkdesign 06 Feb, 2011
Thank you, I appreciate your help!
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger