Hi
i d'like to have an if statement in the form for a checkbox. (http://www.x-mascard.ch/stadtpolizei/)
So when i check the box, it should send a defined text. When its uncheckd, it should send the text in the "Nachricht" field. How can i do this? My solutions do not work😟


Thanks in advance and best regards
Patrik
i d'like to have an if statement in the form for a checkbox. (http://www.x-mascard.ch/stadtpolizei/)
So when i check the box, it should send a defined text. When its uncheckd, it should send the text in the "Nachricht" field. How can i do this? My solutions do not work😟


Thanks in advance and best regards
Patrik
Hi Heeb,
The $_POST is not needed. Please try this:
Bob
The $_POST is not needed. Please try this:
<?php
if ( isset($form->data['input_checkbox_11']) ) {
$form->data['input_textarea_5'] = 'Standart';
} else {
$form->data['input_textarea_5'] = $form->data['Nachricht'];
}
?>
Bob
Hi Bob.
Thx for your solution. In the Confirmation Page (in the debugger) i can see that the $form->data['input_checkbox_11'] is passed correct but it seems as the PHP code is ignored. The value in the $form->data['input_textarea_5'] is always "standart" all the same checked or not.
Is it an order problem from the actions?
Patrik
Thx for your solution. In the Confirmation Page (in the debugger) i can see that the $form->data['input_checkbox_11'] is passed correct but it seems as the PHP code is ignored. The value in the $form->data['input_textarea_5'] is always "standart" all the same checked or not.
Is it an order problem from the actions?
Patrik
Hi Patrik,
I missed a ) from the 'if' line in the code - now fixed. If that doesn't solve it please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.
Bob
I missed a ) from the 'if' line in the code - now fixed. If that doesn't solve it please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.
Bob
i ve fixed the missing ) from the "if" line in the code.
You can fill out the form Link, i ve dragged a debugger action on the submit event. After you can see the debuggers result on the confirmation Page. I have the same template code for the email like on the confirmation page.
Thx for your help!
Patrik
You can fill out the form Link, i ve dragged a debugger action on the submit event. After you can see the debuggers result on the confirmation Page. I have the same template code for the email like on the confirmation page.
Thx for your help!
Patrik
Hi Patrik,
The 'ghost' setting is on I think so the isset() check isn't enough. Please try:
Bob
The 'ghost' setting is on I think so the isset() check isn't enough. Please try:
<?php
if ( isset($form->data['input_checkbox_11']) && $form->data['input_checkbox_11'] ) {
$form->data['input_textarea_5'] = 'Standart';
} else {
$form->data['input_textarea_5'] = $form->data['Nachricht'];
}
?>
Bob
This topic is locked and no more replies can be posted.