I use chronoforms on all my websites.
It is useful that the code can be modified
Now I am looking for a piece of code which will not, when a certain checkbox is checked, email the data.
For example:
Have you ever had contact? Option: Yes | No
Under both options, the form should be sent, but with option no, I do not want in my mailbox.
Below the current code:
Does anyone here have a solution?
grtz
Stefan
It is useful that the code can be modified
Now I am looking for a piece of code which will not, when a certain checkbox is checked, email the data.
For example:
Have you ever had contact? Option: Yes | No
Under both options, the form should be sent, but with option no, I do not want in my mailbox.
Below the current code:
<div class="form_item">
<div class="form_element cf_checkbox">
<label class="cf_label" style="width: 180px;">Ever had contact before?</label>
<div class="float_left">
<input value="yes" title="Required field !" class="radio validate-one-required" id="check00" name="check0[]" type="checkbox" />
<label for="check00" class="check_label">Yes</label>
<input value="No" title="Field required !" class="radio validate-one-required" id="check01" name="check0[]" type="checkbox" />
<label for="check01" class="check_label">No</label>
<br />
</div>
Does anyone here have a solution?
grtz
Stefan
Hi Stefanj,
In the Email Setup | Properties box set Enabled to 'No'. Then add this code to the OnSubmit Before Email box.
and edit your Form HTML so you have a pair of radio buttons instead of two checkboxes (which could both be checked).
Bob
In the Email Setup | Properties box set Enabled to 'No'. Then add this code to the OnSubmit Before Email box.
);
$check0 = JRequest::getVar( 'check0', '', 'post');
if ( $check0 == 'yes' ) {
$MyFormEmails->setEmailData(0, 'enabled', '1');
}
?>
and edit your Form HTML so you have a pair of radio buttons instead of two checkboxes (which could both be checked).
<input value="yes" title="Required field !" class="radio validate-one-required" id="check00" name="check0" type="radio" />
<label for="check00" class="check_label">Yes</label>
<input value="no" title="Field required !" class="radio validate-one-required" id="check01" name="check0" type="radio" />
<label for="check01" class="check_label">No</label>
Bob
Sorry GreyHead,
I tried your solution but it will not work.
The data is stored in the database, for both options (yes and no).
But the form does not send any emails anymore.
What can I do wrong?
I tried your solution but it will not work.
The data is stored in the database, for both options (yes and no).
But the form does not send any emails anymore.
What can I do wrong?
Hi StefanJ,
Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.
Bob
Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.
Bob
Hi Stefanj,
Two little mistakes in my code :-( Here's the corrected version:
Bob
a) the first line should be <?php
b) the Email id is 1, not 0 after setEmailData(
Two little mistakes in my code :-( Here's the corrected version:
<?php
$check0 = JRequest::getVar( 'check0', '', 'post');
if ( $check0 == 'yes' ) {
$MyFormEmails->setEmailData(1, 'enabled', '1');
}
?>
Bob
a) the first line should be <?php
b) the Email id is 1, not 0 after setEmailData(
This topic is locked and no more replies can be posted.