dynamic subject email help!

darkchild 05 Aug, 2010
Hi there,

Just tweaking my multiform setup. All is working smooth but i was wondering if it is possible to do something like this for an email subject:

"MyCompanyNameHere Job Application: Job Applied for - Surname of applicant"

I created a test form and here is the code:

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Position Applied For:</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_1" name="text_1" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Surname:</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_2" name="text_2" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>


From the code the job applied for will be text_1 and the surname text_2.

I am just unsure what code i should and put. I am guessing i want to put some kind of code in.

" On Submit code - before sending email:
(May contain PHP code with tags)"

This is in the motherform right (am using a multipage form). So far i have created an email in Setup Emails section on the motherform and put 'subject' in the dynamic subject field. Would just like some help with the code.

Thanks in advance.
GreyHead 05 Aug, 2010
Hi darkchild ,

Yes, you can do that by 'building' the subject in the OnSubmit Before box. Please search here on subject or first_name to find some examples.

Bob
darkchild 05 Aug, 2010
<?php
$name =& JRequest::getString('text_1', '', 'post');
$surname =& JRequest::getString('text_2', '', 'post');
$subject = 'Job Application';
if ( $name ) {
  $subject .= ': '.$name;
}
if ( $surname) {
  $subject .= ' - '.$surname;
}
JRequest::setVar('subject', $subject);


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