Custom form - Email options - Omitting blank answers


(David Herrington) #1

I am working on the email options of a form and wondered if there was a way of omitting questions in the form that weren't answered from the %form_summary%? I'm trying to neaten up the email that goes to our staff.

 

So for example, if you had the following questions (all required except for Address Line 2):

 

*Name

*Address Line 1

 Address Line 2

*Town 

*Country

 

and Address Line 2 was left blank by the user as they didn't need to fill it in, can it be omitted from the form summary because it was left blank?


(Tim Davison) #2

Not if you are using the form_summary keyword.  You will need to totally re-code all the responses with keywords for each individual question.  Some examples of what I do:

Submission Time: %globals_date_r%

%question_name_6050_q1% : %response_6050_q1%
%question_name_6050_q3% : %response_6050_q3^empty:-- blank --%
%question_name_6050_q6% : %response_6050_q6^gt:1:Agreed:Not agreed%
%question_name_6050_q7% : %response_6050_q7^gt:1:Yes:No%

*Note, the ^gt:1 is used to detect if it's got a value, not necessarily a numeric value.  This is preferable to ^empty and ^notempty as it gives you both true/false options, whereas empty/notempty will display the actual value when these conditions evaluate to false.  Often this behaviour is useful, but not always.

 

Like the forms page contents bodycopy, if you use the generic out-of-the-box layouts you pretty much get stuck with the basic layout.  If you want to customise it you need to go down this more intensive coding path. It's more work, but in my experience definitely worth it and very powerful.

 

Update: So to actually answer you question....

%response_xxx_q1%<br />                             <!-- Name -->
%response_xxx_q2%<br />                             <!-- Address 1 -->
%response_xxx_q3%%response_xxx_q3^notempty:<br />%  <!-- Address 2, only add break if has value -->
%response_xxx_q4%<br />                             <!-- Town -->
%response_xxx_q5%<br />                             <!-- Country -->

(David Herrington) #3

Thanks Tim, I really appreciate the comprehensive response.

 

I already customise the format of the forms I create so i'm not a stranger to that. I will have a go at customising the email options now.

 

Thanks again