Forums

Why won't my email template work?

eppskevin 05 Aug, 2007
I've set the configuration to "My Template", and I just get an empty email with my IP at the bottom.

Here's my form code:

<table width="100%" border="0">
  <tr>
    <td>Respondent</td>
    <td><input name="respondent" type="text" id="respondent" /></td>
  </tr>
  <tr>
    <td>Email</td>
    <td><input name="email" type="text" id="email" /></td>
  </tr>
  <tr>
    <td>Phone</td>
    <td><input name="phone" type="text" id="phone" /></td>
  </tr>
  <tr>
    <td>Agency Name </td>
    <td><input name="agency" type="text" id="agency" /></td>
  </tr>
  <tr>
    <td>City, State </td>
    <td><input name="city" type="text" id="city" /></td>
  </tr>
</table>
<p>Ryan White CARE Act funding (Select all that apply):<br />
  <label>
  <input name="ryan1" type="checkbox" id="na" value="Not Applicable" />
  Not Applicable</label>
  <input name="ryan2" type="checkbox" id="iii" value="Title III" />
  Title III 
  <input name="ryan3" type="checkbox" id="iv" value="Title IV" />
  TitleIV</p>
<ol>
  <li>What is you profession/discipline? (Select one) 
    <p>
      <label>
        <input type="radio" name="RadioGroup1" value="Case Manager" />
        Case Manager</label>
      <br />
      <label>
        <input type="radio" name="RadioGroup1" value="Health Educator" />
        Health Educator</label>
      <br />
      <label>
        <input type="radio" name="RadioGroup1" value="Substance Abuse Counselor" />
        Substance Abuse Counselor</label>
      <br />
      <label>
        <input type="radio" name="RadioGroup1" value="Mental Health Counselor" />
        Mental Health Counselor</label>
      <br />
      <label>
        <input type="radio" name="RadioGroup1" value="Other" />
        Other (specify)</label> <input name="othertext1" type="text" />
      <br />
    </p>
  </li>
  <li>In the past 12 months, have you worked with patients or clients in the following populations: (Select all that apply) 
    <p>
      <label>
        <input type="checkbox" name="ques2[]" value="HIV positive without AIDS diagnosis" />
        HIV positive without AIDS diagnosis</label>
      <br />
      <label>
        <input type="checkbox" name="ques2[]" value="HIV positive with AIDS diagnosis" />
        HIV positive with AIDS diagnosis</label>
      <br />
      <label>
        <input type="checkbox" name="ques2[]" value="Had an STD" />
        Had an STD</label>
      <br />
    </p>
  </li>
  <li>What length of time do you prefer for continuing professional education/training programs? (Indicate longest duration)
    <p>
      <label>
        <input type="radio" name="ques3" value="No preference" />
        No preference</label>
      <br />
      <label>
        <input type="radio" name="ques3" value="Less than half's day" />
        Less than half's day</label>
      <br />
      <label>
        <input type="radio" name="ques3" value="Half day" />
        Half day</label>
      <br />
      <label>
        <input type="radio" name="ques3" value="Full day" />
        Full day</label>
      <br />
      <label>
        <input type="radio" name="ques3" value="2-3 days" />
        2-3 days</label>
      <br />
    </p>
  </li>
  <li>How far are you willing to travel to receive education/training? (Indicate farthest distance)
  <p>
      <label>
        <input type="radio" name="ques4" value="No preference" />
        No preference</label>
      <br />
      <label>
        <input type="radio" name="ques4" value="On-site location" />
        On-site location</label>
      <br />
      <label>
        <input type="radio" name="ques4" value="City in which you work" />
        City in which you work</label>
      <br />
      <label>
        <input type="radio" name="ques4" value="State in which you work" />
        State in which you work</label>
      <br />
      <label>
        <input type="radio" name="ques4" value="Other" />
        Other</label>
      <br />
    </p></li>
  <li>In the past 2 years, approximately how many different professional education/training programs have you participated in that included HIV/AIDS-related topics? (Select one)
  <p>
      <label>
        <input type="radio" name="ques5" value="None" />
        None</label>
      <br />
      <label>
        <input type="radio" name="ques5" value="1 - 2 events" />
        1 - 2 events</label>
      <br />
      <label>
        <input type="radio" name="ques5" value="3 - 5 events" />
        3 - 5 events</label>
      <br />
      <label>
        <input type="radio" name="ques5" value="6 - 10 events" />
        6 - 10 events</label>
      <br />
      <label>
        <input type="radio" name="ques5" value="More than 10 events" />
        More than 10 events</label>
      <br />
    </p></li>
  <li>Please tell us about other ways the NC AIDS Education Center can assist you to deliver optimum care to people living with HIV. 
  <p><textarea style="width: 80%;" name="comments" cols="" rows=""></textarea></p>
  </li>
</ol>
<input name="submit" type="submit" value="Send Evaluation Results" />


Email Template

<p>A Evaluation has been done by {respondent}. Here are the results.</p>
<table width="100%" border="0">
  <tr>
    <td>Email</td>
    <td>{email}</td>
  </tr>
  <tr>
    <td>Phone</td>
    <td>{phone}</td>
  </tr>
  <tr>
    <td>Agency Name </td>
    <td>{agency}</td>
  </tr>
  <tr>
    <td>City, State </td>
    <td>{city}</td>
  </tr>
  <tr>
    <td><p>Ryan White CARE Act funding  (Select <strong>all</strong> that apply)</p></td>
    <td>{ryan1}{ryan2}{ryan3}</td>
  </tr>
  <tr>
    <td>What is your <strong>profession/discipline</strong>?  </td>
    <td>{RadioGroup1}{othertext1}</td>
  </tr>
  <tr>
    <td>In the <strong>past  12 months</strong>, have you worked with patients or clients in the following  populations: </td>
    <td>{ques2}</td>
  </tr>
  <tr>
    <td>What <strong>length  of time</strong> do you prefer for continuing professional education/training  programs</td>
    <td>{ques3}</td>
  </tr>
  <tr>
    <td>How <strong>far</strong> are you willing to travel to receive education/training</td>
    <td>{ques4}</td>
  </tr>
  <tr>
    <td>In the <strong>past  2 years</strong>, approximately how many different <strong>professional education/training programs</strong> have you participated in  that included <strong>HIV/AIDS</strong>-related  topics?  </td>
    <td>{ques5}</td>
  </tr>
  <tr>
    <td>Please tell us  about<strong> other ways </strong>the NC HIV Training  Center can <strong>assist </strong>you to deliver<strong> optimum care</strong> to <strong>people living with HIV</strong>.</td>
    <td>{comments}</td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>
<p>  </p>


Please help!
GreyHead 05 Aug, 2007
Hi eppskevin,

Your code generates an e-mail OK on my test system so maybe the problem is with the entries in the General tab?

Bob

eppskevin 05 Aug, 2007
This is what I have set:

Email Results: yes
Email Address(es): [email]kevine@scimedsolutions.com[/email]
Email Subject: Evaluation Results for Community Providers

Form method: Post
Record and Send user IP's: yes
From Email: [email]kevine@scimedsolutions.com[/email]
From Name: Kevin Epps
Reply to Email: [email]kevine@scimedsolutions.com[/email]

The rest of the fields are empty.

I don't want an email sent to the one filling out the form, just me.

If I set the configuration to "Field entries", then it sends the email as it should in that state, values with the element names beside them.

Am I missing something?
GreyHead 05 Aug, 2007
Hi eppskevin,

Hmmm that all looks OK to me . . .

Just double checking here. With the config set to 'Field entries' it all works OK. When you switch the config to 'My template' then you get no e-mail. Am I understanding correctly?

Are you using the most recent version of ChronoForms - some earlier versions had problems with array variables like 'ques2[]'??

Bob
eppskevin 05 Aug, 2007
I'm using the most current version.

Yeah, when 'Field entries' is set, it works fine.

But, when 'My template' is set, then I just get a blank email with my IP at the bottom.
GreyHead 06 Aug, 2007
Hi eppskevin,

Trying to think through how this might happen. It's pretty much the same code in both cases and it appears to run OK when I test it.

You'd get this if you selected 'My template' and the template was empty. Sounds silly, but please will you double check that you have the template code in the 'Email template field'

Then please try putting this code snippet into the 'On Submit code - after sending email' field
<?php
echo "<h4>E-mail message</h4>
 <div style='border:1px solid black; padding:6px;margin:6px;'>
 <p>From: $fromname [$from]<br />
 To:  ".implode($recipient,', ')."<br />
 Subject: $subject</p>
 $html_message<br /></div>";
?>
This will show a 'dummy e-mail' on the page after you submit the form (you can delete it when it's not longer needed).

Please then submit the form and see what shows up in the dummy e-mail - I've just checked again and it looks fine here.

Bob
eppskevin 06 Aug, 2007
This is the error that comes up:

Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 12 in /home/ncaetcn/public_html/components/com_chronocontact/chronocontact.php on line 167

Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 12 in /home/ncaetcn/public_html/components/com_chronocontact/chronocontact.php on line 167

Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 12 in /home/ncaetcn/public_html/components/com_chronocontact/chronocontact.php on line 167

Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 13 in /home/ncaetcn/public_html/components/com_chronocontact/chronocontact.php on line 167

Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 13 in /home/ncaetcn/public_html/components/com_chronocontact/chronocontact.php on line 167

Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 13 in /home/ncaetcn/public_html/components/com_chronocontact/chronocontact.php on line 167
eppskevin 06 Aug, 2007
The error came from the checkboxes. When I took the brackets from the checkbox names, it worked.

How can I use checkboxes and make sure this error won't come up?
Max_admin 06 Aug, 2007
Hi eppskevin,

Which version of ChronoForms are you using ? the checkboxes shouldn't be a problem, please make the checkboxes names in your template as :
{ques2[]}
I mean include the double brackets!

Let us know the results!

Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
eppskevin 06 Aug, 2007
I'm using V2.2.1.

I've added that, and I'm still getting that error.
GreyHead 06 Aug, 2007
Hi eppskevin,

I thought that all the array problems had been fixed in the latest release but it looks as though something has slipped through.

I only have a few minutes this morning - I've sent you a private email with a copy of my modified version of chronocontact.php to see if that fixes the problem.

Will look in more detail as soon as I have time.

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