Hi all,
I want to make a contactform with in it a checkbox field to send the submitter a copy of his submitted details. I think I can use the auto responder in FormIt for this, but how can I only activate this when the submitter has checked the checkbox?
Regards, Bert
-
- 21 Posts
Just needed this for myself and thought I'd post my solution.
Might not be the cleanest approach but here we go:
Step 1 - Markup
<input type="checkbox" name="sendcopy" value="1"> Send me a copy
Step 2.1 - FormIt call
add this to your FormIt call
hooks:
sendcc
example:
&hooks=`sendcc,spam,email,redirect`
Step 2.2 - FormIt call
add this to your FormIt call:
Step 3 - create FormIt Hook/Snippet
create a new snippet called
sendcc:
<?php
$sendcopy = $hook->getValue('sendcopy');
$email = $hook->getValue('email'); // assuming your email INPUT field is name="email"
$sendcopy == '1' ? $ccemail = $email : $ccemail = ''; // the ugly part. not setting it would make PHP send it literally to [[+ccemail]] and fail
$hook->setValues(array(
'ccemail' => $ccemail
));
return true;
Hope that helps.
▙▚▚▜ I don't think I can, you see, I'd have to want to ▙▚▚▜