Forums

Handling email output for blank fields

kona_pete 12 May, 2009
I have a number of fields in my form that are not "required" and if the user leaves a field blank I don't want to see the field in the resulting email.

Example:
Fields in template are,
Name: {Name}
Age: {Age}
Phone: {Phone}

If the user leaves the Age field blank, I see this in the email,
Name: Pete
Age: {Age}
Phone: 555-1212

But I want to see this,
Name: Pete
Phone: 555-1212
(the age field not included)

Does anybody know how to do this?

Thanks, Kona Pete
GreyHead 12 May, 2009
Hi Kona Pete,

No easy answer, you can switch the html template editor off and add PHP to the template to check which fields nave values and display those.

Bob
Max_admin 14 May, 2009
Hi Kona,

Actually you should not have Age: {Age} in the email if Age is left empty, you should have Age : ONLY! which Chronoforms version do you have ?

to remove the line completely then you need to use PHP as Bob suggested!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.