Forums

mail layout dependant on a field value?

jimwin 21 Aug, 2008
hi there,

I'm setting up a match results form for my local pool league, and I've been using Chronoforms to do this.
So far I've used javascript to change the view of the form (hide / show elements) depending on what type of result is being input (eg league or cup).

I'd like to be able to send mail to the league secretary with a different layout depending on the value selected in the {match_type} field I've created, but I'm struggling for ideas.

Can anyone offer any suggestions?
GreyHead 21 Aug, 2008
Hi jimwin,

You can use a switch statement in the OnSubmit before box to build an range of different email messages by setting the value of $html_message. Unfortunately much of the message processing is done before OnSubmit before runs so you ahve to create a whole html page and substitute in the values you need.

Alternatively you can hack chronocontact.php and move the OnSubmit before code block from around line 422 up to around line 292. Then you can put a template just like the normal code in the template box into $rows[0]->html and ChronoForms will substitute the values and add the remaining page code.

Bob

PS All this applies up to CF 2.5 - it may or may not work in CF v3
jimwin 21 Aug, 2008
Thanks for the very quick response Bob!

This sounds pretty complicated for me, as I'm just a beginner 😶 . I've been doing some html, forms, and now javascript, but I've not delved into PHP yet! I may put this part of the project on hold for a while.
This topic is locked and no more replies can be posted.