Forums

How to set up a checkbox "send email" to surfer himself ?

sindb 15 Mar, 2009
Hi🙂,

I want to set up a checkbox so the surfer is able to email this "Question/Remark" to himself ?
http://www.bijverdienenviathuiswerk.be/index.php?option=com_chronocontact&Itemid=72

Bob's advice is:
You'd need a Dynamic To field for your form and set the value to "" if they don't check the box.

This is what I have done:
1/ Add a "Dynamic To" field in Setup Emails
2/ Add a Checkbox in my Form via the Wizard Edit

If I add a "Dynamic To" field in Setup Emails and leave this "" blank, then it's gone after a save ?
And if I succeed to place this how can I link this with the surfer his email address ?
Or am I wrong completely ?

PS: Before I added this checkbox the "confirmation text" which comes up after sending this "Question/Remark disappear so the surfer automatically comes on the homepage, but now it doesn't ?
Someone an idea how this comes ?

TIA
sindb
GreyHead 15 Mar, 2009
Hi sindb,

You have to put the field name in the Dynamic To checkbox - but then in the OnSubmit Before box you need to set $emails[0]->dto = ""; if the box is not checked.

Bob
sindb 15 Mar, 2009
Bob,

You have to put the field name in the Dynamic To checkbox
I've added a "Dynamic To" field in "Setup Emails", this is what you meant ?
- but then in the OnSubmit Before box you need to set $emails[0]->dto = ""; if the box is not checked
I have placed this
$emails[0]->dto = "";
in "Form Code" with "On Submit code - before sending email:"

I've notice that after a save this "Dynamic To" is gone ?
Is this because I use a "To" field ?

At the moment I get this:
* Form passed first SPAM check OK
* Form passed the submissions limit (if enabled) OK
* Form passed the Image verification (if enabled) OK
* Form passed the server side validation (if enabled) OK
* Form passed the plugins step (if enabled) OK
* Emails data loaded OK
* Form passed all before email code evaluation OK
* An email has been SENT successfully from (Bijverdienen via thuiswerk)sindb.t@telenet.be to [email]sin.db.gm@gmail.com[/email]
* Debug End


_POST: Array ( [Voornaam] => db [Familienaam] => sin [Email] => [email]sin.db@telenet.be[/email] [Straat] => Grote Heimelinkstraat [huisnummer] => 114 [Postcode] => 9100 [Plaats] => Sint-Niklaas [Provincie] => Oost-Vlaanderen [Land] => België [Telefoon] => 0473... [radio0] => Shopper [Opmerking] => [email]sin.db@telenet.be[/email] shopper JA [check0] => Array ( [0] => Ja ) [chrono_verification] => 43gFH [535c9c192ac2529b097fc3f94392ca88] => 1 )
$emails[0]->dto = "";


From: Bijverdienen via thuiswerk [sindb.t@telenet.be]
To: [email]sin.db.gm@gmail.com[/email]
Subject: DHS inschrijfformulier
Aanvraagformulier Gelieve alle velden met een * in te vullen aub. Voornaam * db Familienaam * sin Email * [email]sin.db@telenet.be[/email] Straat * Grote Heimelinkstraat Huisnummer * 114 Postcode * 9100 Plaats * Sint-Niklaas Provincie * Oost-Vlaanderen Land * België Telefoon / GSM * 0473/78.38.30 Lidmaatschap * Shopper Opmerking / vraag [email]sin.db@telenet.be[/email] shopper JA Submitted by 81.82.2.11


Where can I find this field name or do you mean the label name of this check box ?

TIA
sindb
Max_admin 16 Mar, 2009
Hi sindb,

you need to :

#1- create 2 emails, 1 with static TO for you and another one with Dynamic To for the sender! both emails should be valid and enabled!

#2- in the onusbmit before email box, add this:
if($_POST['your_checkbox']){
$emails[1]->enabled = 0;
}

assuming that your FIRST email is your admin email and the end one is the user's email!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
sindb 17 Mar, 2009
Hi Max,

thanks for your help🙂

I did what you've said and this works🙂

only this line of code you also see before my confirmation text ? see jpg please ?

Any idea how I can solve this please ?

TIA,
sindb
GreyHead 17 Mar, 2009
Hi sindb,

Max's code snippet needs to be inside php tags
<?php
if($_POST['your_checkbox']){
  $emails[1]->enabled = 0;
}
?>
I think that is all.

Bob

Later: fixed typo in last line of code
sindb 17 Mar, 2009
Hi Bob,

thanks, this is very weird, when I tried this yesterday, the code line didn't show up but the second mail wasn't send ? :?
Now it does works ?🙂

Probably I must have mistyped something, I guess.

Do you have an idea why this confirmation message in "On Submit code - after sending email" doesn't goes automatically to the home page like it did before ?
Here is this code:
<h4>Geachte bezoeker,</h4>
<p><strong>Hartelijk dank voor uw interesse. </strong></p>
<p>Uw aanvraag is goed ontvangen. <br /> Wij zullen uw aanvraag zo snel mogelijk behandelen.</p>
<p>Met vriendelijke groeten, <br /> <span style="color: #497a81;">Martine & Rene & Thierry </span><br /> DHS - Team</p>

Should I use here also these php tags ?

TIA
sindb
GreyHead 17 Mar, 2009
Hi sindb,

That looks like OK HTML - doesn't need PHP tags - but there's nothing there to redirect to the home page. The html should show on the ChronoForms 'Thank you' page unless you have a ReDirect URL set.

Bob

PS There was a typo in the closing ?> tag of my last post - now fixed.
sindb 19 Mar, 2009
OK thanks Bob🙂
This topic is locked and no more replies can be posted.