Forum

Thread tagged as: Problem

Form email template not working correctly

Hello, I have a really long form on a client website which has a custom email template to return data based on what the user selects. At about line 500 of the email template the perch if statements seem to stop working. I can't work out why this might be?

Here is where the error first occurs:

<perch:if exists="generalhealth">
<tr><th align="left" valign="top" colspan="3" style="padding-bottom:4px;">How would you describe your child's general health?</th></tr>
<tr><td valign="top" colspan="3" style="padding-bottom:10px;"><perch:email id="generalhealth" /></td></tr>
</perch:if>

<perch:if exists="datelastgp">
<tr><th align="left" valign="top" colspan="3" style="padding-bottom:4px;">Date of your last GP examination</th></tr>
<tr><td valign="top" colspan="3" style="padding-bottom:10px;"><perch:email id="datelastgp" /></td></tr>
</perch:if>

<perch:if exists="nameofgp">
<tr><th align="left" valign="top" colspan="3" style="padding-bottom:4px;">Name of GP</th></tr>
<tr><td valign="top" colspan="3" style="padding-bottom:10px;"><perch:email id="nameofgp" /></td></tr>
</perch:if>

<perch:if exists="addressofgp">
<tr><th align="left" valign="top" colspan="3" style="padding-bottom:4px;">Address of your GP</th></tr>
<tr><td valign="top" colspan="3" style="padding-bottom:10px;"><perch:email id="addressofgp" /></td></tr>
</perch:if>

<perch:if exists="medications">
<tr><th align="left" valign="top" colspan="3" style="padding-bottom:4px;">Indicate any current medications</th></tr>
<tr><td valign="top" colspan="3" style="padding-bottom:10px;"><perch:email id="medications" /></td></tr>
</perch:if>

<tr><th align="left" colspan="3" valign="top" style="padding-bottom:4px;">Please check any conditions your child has suffered</th></tr>
<tr><td valign="top" colspan="3" style="padding-bottom:10px;">
<perch:if exists="medhistory_measles">- Measles<br></perch:if>
<perch:if exists="medhistory_mumps">- Mumps<br></perch:if>
<perch:if exists="medhistory_chickepox">- Chicken Pox<br></perch:if>
<perch:if exists="medhistory_glandularfever">- Glandular Fever<br></perch:if>
<perch:if exists="medhistory_germanmeasles">- German Measles<br></perch:if>
<perch:if exists="medhistory_whoopingcough">- Whooping Cough<br></perch:if>
<perch:if exists="medhistory_colds">- Repeated 'colds'<br></perch:if>
<perch:if exists="medhistory_glueear">- Glue Ear<br></perch:if>
<perch:if exists="medhistory_earaches">- Ear aches<br></perch:if>
<perch:if exists="medhistory_middleear">- Middle ear infections<br></perch:if>
<perch:if exists="medhistory_sorethroats">- Frequent sore throats<br></perch:if>
<perch:if exists="medhistory_tonsillitis">- Tonsillitis<br></perch:if>
<perch:if exists="medhistory_bronchitis">- Bronchitis<br></perch:if>
<perch:if exists="medhistory_pneumonia">- Pneumonia<br></perch:if>
<perch:if exists="medhistory_meningitis">- Meningitis<br></perch:if>
<perch:if exists="medhistory_encephalitis">- Encephalitis<br></perch:if>
<perch:if exists="medhistory_urinarytract">- Urinary Tract Infection<br></perch:if>
<perch:if exists="medhistory_hightemp">- High Temperatures of unknown origin<br></perch:if>
</td></tr>

The "generalhealth" value is returned correctly, but the "datelastgp", "nameofgp" and all future if statements don't work. They simply all output.

Here is the relevant code from the form template as well:

    <h2>Medical History</h2>
    <div class="form-row">
        <div class="form-row-col">
            <perch:label for="generalhealth">How would you describe your child's general health?</perch:label>
            <perch:input id="generalhealth" type="radio" options="Excellent,Good,Fair,Poor" wrap="div.form-radio-wrapper" label="How would you describe your child's general health?" />
        </div>
    </div>
    <div class="form-row">
        <div class="form-row-col form-row-col-half">
            <perch:label for="datelastgp">Date of your last GP examination</perch:label>
            <perch:input type="text" id="datelastgp" label="Date of your last GP examination" />
        </div>
        <div class="form-row-col form-row-col-half">
            <perch:label for="nameofgp">Name of GP</perch:label>
            <perch:input type="text" id="nameofgp" label="Name of GP" />
        </div>
    </div>
    <div class="form-row">
        <div class="form-row-col">
            <perch:label for="addressofgp">Address of your GP</perch:label>
            <perch:input type="text" id="addressofgp" label="Address of your GP" />
        </div>
    </div>
    <div class="form-row">
        <div class="form-row-col">
            <perch:label for="medications">Indicate any current medications</perch:label>
            <perch:input type="text" id="medications" label="Indicate any current medications" />
        </div>
    </div>
    <div class="form-row">
        <div class="form-row-col">
            <perch:label>Please check any conditions your child has suffered</perch:label>
            <div class="form-checkbox-wrapper">
                <perch:label for="medhistory_measles"><perch:input type="checkbox" id="medhistory_measles" value="true" label="Measles" /> Measles</perch:label>
            </div>

Any ideas? The data looks correct in the view responses section of admin so I'm thinking maybe the email is too big or something?

Brad Hardinge

Brad Hardinge 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have more than 100 perch:if tags in the template?

Hi Drew, yes there would be. Is there a limit?

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's currently a limit of 100 per template. Anything more than that is presumed to be a syntax error.

In Perch 2.9 it's set to 1000, as it turns out people are building crazy complex templates.

Ah okay. When will 2.9 be released? Is there a way for me to remove the limit for the time being on a specific website?

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's not a way to change it currently. The work around would be to use fewer conditional tags.

I've reduced the if tags as much as possible and there is still 112 (12 too many!). So the email notifications are incorrect for the client. Any timeline on 2.9 I can stall them with or anything?

Drew McLellan

Drew McLellan 2638 points
Perch Support

We don't have a release date as yet.