Hello I had different forms and I’m trying to use only one [[!formit call for all of them.
[[!FormIt?
&preHooks=`formCustomFields`
&hooks=`spam,email,redirect`
&emailFrom=`[[+email]]`
&emailFromName=`[[+firstname]] [[+lastname]]`
&emailSubject=``
&redirectTo=``
&emailTo=`[[++email]]`
&emailTpl=``
&validate=`nospam:blank`
]]
So I create a form inside a chunk called [[$Form]] that include 3 hidden input fields with the settings I need to replace:
<input type="hidden" name="subject" value="[[+subject]]" />
<input type="hidden" name="redirect" value="[[+redirect]]" />
<input type="hidden" name="tpl" value="[[+tpl]]" />
Then I fill the hidden fields with the right info, using the chunk call:
[[$contactForm? &subject='Form One' &redirect='53' &tpl='chunkFormOne']]
Now I create a &preHooks=‘formCustomFields’ where I 'm trying to read and set the settings:
<?php
$formit =& $hook->formit;
$values = $hook->getValues();
$subject = $values['subject'];
$redirect = $values['redirect'];
$tpl = $values['tpl'];
$formit->config['emailSubject'] = $subject;
$formit->config['redirectTo'] = $redirectTo;
$formit->config['emailTpl'] = $tpl;
return true;
But the Freaking thing is not working… what am I doing wrong?
any help will be welcome, Thanks!!!