I made a simple contactform with chronoforms. With the module 'mod_chronocontact' I put it in the left module of my website.
Whem somebody fill and submit the form, the 'thank you'-message appears in the component.
Is there a way to put the 'thank you'-message in the module. Or when filled in, let the module dissapear/ hide the module?
Greeting,
Tijs
Whem somebody fill and submit the form, the 'thank you'-message appears in the component.
Is there a way to put the 'thank you'-message in the module. Or when filled in, let the module dissapear/ hide the module?
Greeting,
Tijs
Hi Tijs,
unfortunately this is not possible yet, but here is a workaround, redirect the user to the same page with &finished=1 at the url, and use a php code switch at the top of the form code to show a thanks message if it reads finished=1 in the url!
Max
unfortunately this is not possible yet, but here is a workaround, redirect the user to the same page with &finished=1 at the url, and use a php code switch at the top of the form code to show a thanks message if it reads finished=1 in the url!
Max
Hello Max,
Thank you for the reply. The workaround doesn't do the job for me. Because the module is there again if someone views another page.
There are 2 options I was thinking about:
1: In the template make a connection with the database, check if the persons IP adress is added to the chrone-database, and if so then do not show the module.
Disadventage: If the IP adress is from a school or something, only one person from the school can use the module.
2: When someone fill in the form and send it make a setcookie in PHP. And in the template make a if-statement. Something like:
if($_COOKIE = "completedform"): //no module; else: //show module left; endif;
What do you think of these options?
Thank you for the reply. The workaround doesn't do the job for me. Because the module is there again if someone views another page.
There are 2 options I was thinking about:
1: In the template make a connection with the database, check if the persons IP adress is added to the chrone-database, and if so then do not show the module.
Disadventage: If the IP adress is from a school or something, only one person from the school can use the module.
2: When someone fill in the form and send it make a setcookie in PHP. And in the template make a if-statement. Something like:
if($_COOKIE = "completedform"): //no module; else: //show module left; endif;
What do you think of these options?
I forgot another option:
The use of Sessions, the same as option 2 but no need for Coockies anymore.
So I was thinking of the following:
In Chronoforms -> formcode in On Submit code - before sending email:
I put something like this:
<?php
$currentSession = JSession::getInstance('none',array());
$currentSession->set("filled","yes");
$stores = $currentSession->getStores();
?>
I don't know if this is the way to save a Session in Joomla.
Then in te Template I will check if the Session is set:
if($this->countModules('left')) && isset($_SESSION['filled']) && $_SESSION['filled'] == 'yes'):
//no module
else:
<jdoc:include type="modules" name="left" style="xhtml" />
endif;
I think it should be something like this, but I need someone who can help me a little?
With kind regards,
Tijs
The use of Sessions, the same as option 2 but no need for Coockies anymore.
So I was thinking of the following:
In Chronoforms -> formcode in On Submit code - before sending email:
I put something like this:
<?php
$currentSession = JSession::getInstance('none',array());
$currentSession->set("filled","yes");
$stores = $currentSession->getStores();
?>
I don't know if this is the way to save a Session in Joomla.
Then in te Template I will check if the Session is set:
if($this->countModules('left')) && isset($_SESSION['filled']) && $_SESSION['filled'] == 'yes'):
//no module
else:
<jdoc:include type="modules" name="left" style="xhtml" />
endif;
I think it should be something like this, but I need someone who can help me a little?
With kind regards,
Tijs
Hi Tijs,
The session solution is better for sure, here are my thoughts:
and in the onSubmit box of the form:
cheers
Max
The session solution is better for sure, here are my thoughts:
$session =& JFactory::getSession();
if(!$session->get('formsubmitted', '0')){
//show module
}else{
//dont show it
}
and in the onSubmit box of the form:
$session =& JFactory::getSession();
$session->set('formsubmitted', '1');
cheers
Max
Hi, I'm interested in this same issue, however I would like to show the thank you message rather than hide the module. Would you mind sharing what the PHP code for the finished=1 switch would be that I need to add at the top of the form code?
Thanks!
Thanks!
This topic is locked and no more replies can be posted.