Forums

On Submit code - before sending email

jan35utr 09 Jul, 2011
In my previous version (joomla1.5) I had a code creating a email subject depending on several imputs

I tried several ways in the new V4 to add this code in "Load JS" event in "On Submit" but keep receiving empty email subjects

the code I used in the old version is:

<?php
$Sub1 = JRequest::getString('radio0', '', 'post');
$Sub2 = JRequest::getString('leeg', ' ', 'post');
$Sub3 = JRequest::getString('CompName', '', 'post');
$Sub4 = JRequest::getString('application', '', 'post');
JRequest::setVar('subject', 'eComNL ' .$Sub1 .$Sub2 .$Sub3);
?>

any ideas???

thanks in advance,

Jan
GreyHead 09 Jul, 2011
Hi Jan,

The code snippet is PHP (not JavaScript) and needs to go in a Custom Code action in the OnSubmit event. Drag the action up so that it is before any Email action. The code is slightly different:
<?php
$Sub1 = JRequest::getString('radio0', '', 'post');
$Sub2 = JRequest::getString('leeg', ' ', 'post');
$Sub3 = JRequest::getString('CompName', '', 'post');
$Sub4 = JRequest::getString('application', '', 'post');
$form->data['subject'] = 'eComNL '.$Sub1.$Sub2.$Sub3;
?>

Bob
jan35utr 10 Jul, 2011
Hi Bob,

thanks a mil!!! it works :-)

greetz,

Jan
This topic is locked and no more replies can be posted.