Forums

Display form site wide

Canard 15 Oct, 2014
Hello !
The website I'm working on already uses different chrono forms which are inserted as articles :
{chronocontact}myForm{/chronocontact}
I assume they used the plugin version.
I would like to create a form consisting in two image buttons allowing the user to select a language (actually French or English).
I plan to get the form data in order to set a session variable.
As my form has to be on the page top site wide, what would be the best way to achieve this ?
Thank you for your help.
GreyHead 15 Oct, 2014
Hi Canard,

You can use the ChronoForms module to put a form in a template module location. You will probably need to use some custom CSS and HTML to get it looking just the way you want,

Bob
Canard 22 Oct, 2014
Ok, I installed chronoForms module for J 1.5 and set it up to show my form.
I get this error : Fatal error: Undefined class name 'modchronoformshelper' in /home/cybellep/www/test/modules/mod_chronoforms/mod_chronoforms.php on line 8
is PHP version the cause of this ?
GreyHead 22 Oct, 2014
Hi Canard,

That class is in the file /modules/mod_chronoforms/helper.php does that exist on your site?

Bob

PS You have an old release of an old version of ChronoForms there. Have you looked at upgrading to the latest v3.2 release of CFv3?
Canard 23 Oct, 2014
Hi Bob, thank you for your reply.
The module I've just installed is mod_chronoforms V4 RC3.0 and does contain helper.php
As for the component chronocontact, it is version 3.1 RC4.11, but the error came before I assigned a form to the module.
Does this help you to see where it may come from ?
David.
GreyHead 23 Oct, 2014
Answer
Hi David,

If those are correct it sounds as though you have installed the CFv4 module when you need the CFv3 one.

Bob
Canard 23 Oct, 2014
Thank you Bob, once again you were right, I installed V3 and it works as expected !
Canard 24 Oct, 2014
Hi again ! yes my form works as expected but only if DEBUG is ON
<?php 
/*set session language*/
/*$session =& JFactory::getSession();
$session->set('language', $_POST[lang]);*/
$_SESSION[language]=$_POST[lang];
echo 'langue='.$_SESSION[language]; 
?>
<form id="ChronoContact_langue" action="index.php?option=com_chronocontact&task=send&chronoformname=langue" method="post" name="ChronoContact_langue">
<table class="langTable">
<tbody>
<tr>
<td>
<input id="btFR" type="submit" name="lang" value="FR">
</td>
<td>
<input id="btUK" type="submit" name="lang" value="UK">
</td>
</tr>
</tbody>
</table>
</form>

Any idea about it ?
GreyHead 24 Oct, 2014
1 Likes
Hi Canard,

What exactly doesn't work?

Bob
Canard 24 Oct, 2014
Sorry, it was obvious for me but I realize now I did not give any info :?
When debug is OFF
$_POST[lang]
is not set, whereas when ON it is ok.
GreyHead 24 Oct, 2014
1 Likes
Hi David,

It's probably simpler to use the Joomla! language features for this that to build your own.

$_POST should be the same whether or not debug is on. Is the form submitting without the debug?

Bob

.
Canard 24 Oct, 2014
You are right Bob, the problem is they want very partial translation and some modules toggle depending on the selected language.
Anyway I resolved the problem by setting me session variable in
On Submit code - after sending email

The variable is now updated as desired. I now have to set the whole thing up according to that variable.
Thank you very much for your help, I'll try not to bother you for a while😉
Regards,
David.
Canard 28 Oct, 2014
Hi !
my language form is working like a charm now, thank you for your great module and support !
My language variable is getting stored in session and I can handle it site wide, but one (last ?) problem remains : I can't manage to redirect to the currently viewed page (the form only consist in two buttons on top of all pages, I would like to reload the current page on submit). An empty redirect URL leads to a blank content, a # leads to
You are not allowed to access this URL directly, POST array is empty 
and index.php leads to... index.php.
I tried putting this
<?php
$currenturl = JURI::current();
$form->data['redirect_url'] = $currenturl;
echo $currenturl;
?>

in form code, the echo is working as expected but it does not override the "Form URLs" redirect URL setting whether empty or not.
I guess the answer to my need is obvious but I don't get it.
This topic is locked and no more replies can be posted.