Send copy to sender checkbox

ProCessor 05 May, 2014
Hi,

I have created a checkbox field with the question if the submitter of the form wants a copy of submitted form.
My question now is, how can I configure the setup in such a way that only a copy is sent to the submitter if the checkbox was checked?

Thanks in advance.

Kind regards,
Patrick
Max_admin 05 May, 2014
Hi Patrick,

There are many ways to do it, one of them would be using the "Event switcher":
http://www.chronoengine.com/faqs/70-cfv5/5212-event-switcher.html

And the rule code would be:

if(!empty($form->data["checkbox_name"])){
return "success";
}else{
return "fail";
}


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ProCessor 05 May, 2014
Hi Max,

Thanks for your quick reaction.
I did as you said, but it still doesn't send a copy.

Here you can see how my setup is configured:
Send copy to sender checkbox image 1

On submit, firstly I send an email to the site admin (this works).
Next, I send an email to the submitter of the form (this doesn't work).
Then, I show a message (this works).

This is the code I put in EventSwitcher:
if(!empty($form->data["sendcopy"])){
return "success";
}else{
return "fail";
}


What am I doing wrong ?
Max_admin 05 May, 2014
looks fine, please try to add a "debugger" action before the event switcher and test the form in case the checkbox is checked, and in case not, you can post the results here so we can check them too, this should help find the solution.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ProCessor 05 May, 2014
With box checked:
Array
(
    [option] => com_chronoforms5
    [chronoform] => Contactformulier
    [event] => submit
    [name] => Patrick
    [email] => ***
    [subject] => test
    [message] => test
    [sendcopy] => 1
    [submit20] => Submit
    [ip_address] => ***
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
    [0] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:***
                    [2] => Subject:Bericht via website
                    [3] => From name:Website
                    [4] => From email:***
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:Patrick
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Body:
<div class="gform-all">
<div class="gform-section">
<div id="ftr-name" class="gform-line-tr">
<div id="ftd-name" class="gform-line-td"><label class="gform-label-left" for="name">Name</label>
<div id="fin-name" class="gform-input-container gform-input">Patrick</div>
</div>
</div>
<div id="ftr-email" class="gform-line-tr">
<div id="ftd-email" class="gform-line-td"><label class="gform-label-left" for="email">Email</label>
<div id="fin-email" class="gform-input-container gform-input">***</div>
</div>
</div>
<div id="ftr-subject" class="gform-line-tr">
<div id="ftd-subject" class="gform-line-td"><label class="gform-label-left" for="subject">Subject</label>
<div id="fin-subject" class="gform-input-container gform-input">test</div>
</div>
</div>
<div id="ftr-message" class="gform-line-tr">
<div id="ftd-message" class="gform-line-td"><label class="gform-label-left" for="message">Message</label>
<div id="fin-message" class="gform-input-container gform-input">test</div>
</div>
</div>
<div id="ftr-submit5" class="gform-line-tr"> </div>
</div>
</div>
                )

        )

)


Without box checked:
Data Array
Array
(
    [option] => com_chronoforms5
    [chronoform] => Contactformulier
    [event] => submit
    [name] => Patrick
    [email] => ***
    [subject] => Test
    [message] => Test
    [submit20] => Submit
    [ip_address] => ***
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
    [0] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:***
                    [2] => Subject:Bericht via website
                    [3] => From name:Website 
                    [4] => From email:***
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:Patrick
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Body:
<div class="gform-all">
<div class="gform-section">
<div id="ftr-name" class="gform-line-tr">
<div id="ftd-name" class="gform-line-td"><label class="gform-label-left" for="name">Name</label>
<div id="fin-name" class="gform-input-container gform-input">Patrick</div>
</div>
</div>
<div id="ftr-email" class="gform-line-tr">
<div id="ftd-email" class="gform-line-td"><label class="gform-label-left" for="email">Email</label>
<div id="fin-email" class="gform-input-container gform-input">***</div>
</div>
</div>
<div id="ftr-subject" class="gform-line-tr">
<div id="ftd-subject" class="gform-line-td"><label class="gform-label-left" for="subject">Subject</label>
<div id="fin-subject" class="gform-input-container gform-input">Test</div>
</div>
</div>
<div id="ftr-message" class="gform-line-tr">
<div id="ftd-message" class="gform-line-td"><label class="gform-label-left" for="message">Message</label>
<div id="fin-message" class="gform-input-container gform-input">Test</div>
</div>
</div>
<div id="ftr-submit5" class="gform-line-tr"> </div>
</div>
</div>

                )

        )

)


I've hidden mail and IP values to prevent inappropriate use (they were correct though).
Max_admin 09 May, 2014
Answer
Everything is good then, but it looks like you didn't add a PHP open tag before the code, it should be:

<?php
if(!empty($form->data["sendcopy"])){
return "success";
}else{
return "fail";
}


That should make it work as expected!

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.