Redirect to thank you page after using contact form

Need help with the Administration of your Joomla! site? Pop your questions in here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
User avatar
snadowitz
Joomla! Guru
Joomla! Guru
Posts: 764
Joined: Wed Jan 18, 2006 4:40 am
Contact:

Redirect to thank you page after using contact form

Post by snadowitz » Tue Jul 29, 2008 9:07 am

Guys,

how can I direct my users to a proper thank you page after they his the send button on a contact form? I know I saw it somewhere but despite searching I can't find it - driving me mad.................
Snadowitz

User avatar
ranwilli
Joomla! Master
Joomla! Master
Posts: 19136
Joined: Sun Feb 19, 2006 6:47 pm
Location: Toledo, OH
Contact:

Re: Redirect to thank you page after using contact form

Post by ranwilli » Wed Jul 30, 2008 5:52 am

IMO, the easist way to do this is to use one of the forms extensions to make your own "Contact us" form... and you can then program the form to redirect after the form is submitted.

There are many good ones, I use Facile Forms and Phil-a-form.
Don't HACK the Joomla! core, Instead "Extend" and/or "Override."
Stay ON the update path.
https://harpervance.com

szonkie
Joomla! Explorer
Joomla! Explorer
Posts: 256
Joined: Thu Jul 05, 2007 10:41 am

Re: Redirect to thank you page after using contact form

Post by szonkie » Thu Jul 31, 2008 11:52 am

Open Contact.php and go to line 473 - 475 and change the line:

$link = ‘index.php?option=com_contact&task=view&contact_id=’. $contact[0]->id .’&Itemid=’. $Itemid;

mosRedirect( $link, _THANK_MESSAGE )
--------------------------------------------------------------------------------
replace that code with the URL for the contact Thank-you page as defined as follows:
--------------------------------------------------------------------------------
$link = sefRelToAbs( 'index.php?option=com_contact&task=view&contact_id='. $contact[0]->id .'&Itemid='. $Itemid );

mosRedirect( 'index.php?option=com_content&task=view&id=28&Itemid=102' );

Create thankyou page and menu item for ID, change this in the code to redirect to the item ID - remove menu item
Last edited by szonkie on Fri Aug 01, 2008 7:59 am, edited 2 times in total.

User avatar
snadowitz
Joomla! Guru
Joomla! Guru
Posts: 764
Joined: Wed Jan 18, 2006 4:40 am
Contact:

Re: Redirect to thank you page after using contact form

Post by snadowitz » Thu Jul 31, 2008 1:01 pm

thanks mate - I will try this over the weekend. Many thanks.
Snadowitz

szonkie
Joomla! Explorer
Joomla! Explorer
Posts: 256
Joined: Thu Jul 05, 2007 10:41 am

Re: Redirect to thank you page after using contact form

Post by szonkie » Thu Jul 31, 2008 4:47 pm

No probs give me a shout if stuck, I got mine working like this...

rintuttle
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Mon Sep 22, 2008 2:08 pm

Re: Redirect to thank you page after using contact form

Post by rintuttle » Mon Sep 22, 2008 2:14 pm

I got it working by performing the following (used the directions above but had to modify to get it to work):

EDIT: This is on 1.5.7 install.

Open: com_contact >> controller.php

Find "$link" ( line 355 on mine )

Code: Select all

$link = JRoute::_('index.php?option=com_contact&view=contact&id='. $contact->slug .'&catid='.$contact->catslug, false);

$this->setRedirect('index.php?option=com_content&task=view&id=108&Itemid=125');
}
108 = Article ID

125 = Menu Item ID


Thanks for the fix, worked immediately once I got the code right.
[Erin...]

Aly
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 235
Joined: Mon Aug 22, 2005 8:56 pm

Re: Redirect to thank you page after using contact form

Post by Aly » Wed Sep 24, 2008 12:06 am

I'm just amazed that this isn't a default feature! :geek:

User avatar
snadowitz
Joomla! Guru
Joomla! Guru
Posts: 764
Joined: Wed Jan 18, 2006 4:40 am
Contact:

Re: Redirect to thank you page after using contact form

Post by snadowitz » Wed Sep 24, 2008 1:34 pm

me too - put it in as a request for future versions.
Snadowitz

janeinpa
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 190
Joined: Thu Jan 10, 2008 1:43 pm

Re: Redirect to thank you page after using contact form

Post by janeinpa » Sat Jan 31, 2009 9:28 pm

I am not a programmer & having difficulty getting this to work. I never had trouble with it on previous versions of Joomla. What the heck is going on? Why wouldn't it redirect to a thank you page on the registration and contact forms?

I read several posts on what to change in the com_users/controller.php file. I tried replacing some code but it didn't work. Help, please!

User avatar
snadowitz
Joomla! Guru
Joomla! Guru
Posts: 764
Joined: Wed Jan 18, 2006 4:40 am
Contact:

Re: Redirect to thank you page after using contact form

Post by snadowitz » Tue Feb 10, 2009 2:20 am

janeinpa wrote:I am not a programmer & having difficulty getting this to work. I never had trouble with it on previous versions of Joomla. What the heck is going on? Why wouldn't it redirect to a thank you page on the registration and contact forms?

I read several posts on what to change in the com_users/controller.php file. I tried replacing some code but it didn't work. Help, please!


Try pasting the section you edited from the controller.php file and see if someone can work out what is going wrong. What are the symptoms of the problem - exactly.
Snadowitz

janeinpa
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 190
Joined: Thu Jan 10, 2008 1:43 pm

Re: Redirect to thank you page after using contact form

Post by janeinpa » Tue Feb 10, 2009 11:45 am

It turned out to be a problem with the template itself. Luckily I was able to find the solution.

zbabyface
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Sep 19, 2008 4:16 pm

Re: Redirect to thank you page after using contact form

Post by zbabyface » Fri Aug 27, 2010 5:18 pm

It was this simple:

$this->setRedirect('http://mywebsite.com/thank-you.html');

User avatar
ncwebpros
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Nov 18, 2008 4:27 pm
Location: Indian Trail, NC
Contact:

Re: Redirect to thank you page after using contact form

Post by ncwebpros » Fri Aug 19, 2011 1:08 pm

rintuttle wrote:I got it working by performing the following (used the directions above but had to modify to get it to work):

EDIT: This is on 1.5.7 install.

Open: com_contact >> controller.php

Find "$link" ( line 355 on mine )

Code: Select all

$link = JRoute::_('index.php?option=com_contact&view=contact&id='. $contact->slug .'&catid='.$contact->catslug, false);

$this->setRedirect('index.php?option=com_content&task=view&id=108&Itemid=125');
}
108 = Article ID

125 = Menu Item ID


Thanks for the fix, worked immediately once I got the code right.
Thanks for that! Worked perfectly for me!

melaniebund
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Mon Sep 05, 2011 4:31 pm

Re: Redirect to thank you page after using contact form

Post by melaniebund » Thu Sep 15, 2011 4:25 pm

hi i tried - not working - have 1.7 version

if ($contact->params->get('redirect')) {
$this->setRedirect($contact->params->get('redirect'), $msg);
} else {
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false), $msg);

last statement i replaced with below
$this->setRedirect(JRoute::_('index.php?option=com_content&view=article&id=18’, false), $msg);
}
and i get a syntax error in the line
$params = JComponentHelper::getParams('com_contact');

can anyone help?

melaniebund
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Mon Sep 05, 2011 4:31 pm

Re: Redirect to thank you page after using contact form

Post by melaniebund » Thu Sep 15, 2011 5:48 pm

have sorted out is working - was simple syntax mistake - now i have a thank you page but the header/title is "articles" - how do i get rid of that?
thanks

dadset
I've been banned!
Posts: 25
Joined: Wed Aug 03, 2011 1:02 pm

Re: Redirect to thank you page after using contact form

Post by dadset » Fri Sep 16, 2011 8:07 am

szonkie wrote:Open Contact.php and go to line 473 - 475 and change the line:

$link = ‘index.php?option=com_contact&task=view&contact_id=’. $contact[0]->id .’&Itemid=’. $Itemid;

mosRedirect( $link, _THANK_MESSAGE )
--------------------------------------------------------------------------------
replace that code with the URL for the contact Thank-you page as defined as follows:
--------------------------------------------------------------------------------
$link = sefRelToAbs( 'index.php?option=com_contact&task=view&contact_id='. $contact[0]->id .'&Itemid='. $Itemid );

mosRedirect( 'index.php?option=com_content&task=view&id=28&Itemid=102' );

Create thankyou page and menu item for ID, change this in the code to redirect to the item ID - remove menu item
thanks man its very good solution

melaniebund
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Mon Sep 05, 2011 4:31 pm

Re: Redirect to thank you page after using contact form

Post by melaniebund » Fri Sep 16, 2011 4:39 pm

If any one is interested have managed to get rid of the header/title - "articles" -

1. Edit this file in your FTP Manager – Components/com_content/views/article/view_html.php

2. In this file earch and comment out below line.
// $this->params->def(‘page_heading’, JText::_(‘JGLOBAL_ARTICLES’));

alefmemalef64
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Mon Jul 14, 2008 6:50 pm

Re: Redirect to thank you page after using contact form

Post by alefmemalef64 » Thu Mar 21, 2013 12:44 pm

Hi,
I'm resurrecting this topic ... I'm with Joomla 2.5.9 and can't work out how to get the thank you page going. It might be that I don't know which contact.php and controller.php to edit. Checked the files under components/com_contact and the files under administrator/components/com_contact but the files there don't have the code lines mentioned in szonkie's and rintuttle's posts. Any suggestions?

melaniebund
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Mon Sep 05, 2011 4:31 pm

Re: Redirect to thank you page after using contact form

Post by melaniebund » Thu Oct 03, 2013 3:19 pm

Hi
Am having the same problem with my 2.5 - as there is not even a thank you text, the page reloads with fields blank so u presume you have sent the form, which is correct - can you tell me which file to tweek please, to redirect to my thankyou article page
thankyou in advance
melanie


Locked

Return to “Administration - 1.0.x”