Hi
I have a client that wants their email tidied up by removing any of the {field name} that appear when a check box is not checked. How would I do that?
Also was wondering how I would get the values of any check boxes to each be on their own line when the email is generated instead of separated by commas?
Thanks
Warren
I have a client that wants their email tidied up by removing any of the {field name} that appear when a check box is not checked. How would I do that?
Also was wondering how I would get the values of any check boxes to each be on their own line when the email is generated instead of separated by commas?
Thanks
Warren
Hi Warren,
To hide the check box values use this code in the OnSubmit Before box:
This will replace {check0} with a empty string; you could replace '' with 'not checked' or some other value if you prefer.
There is a much more complex example if you search here on 'rucola' (it was for a restaurant).
You can change the array handling by turning off 'Let ChronoForms handle my arrays' and instead using code like this in the OnSubmit Beofer Email box.
Bob
To hide the check box values use this code in the OnSubmit Before box:
<?php
$check0 = JRequest::getVar('check0', '', 'post');
JRequest::setVar('check0', $check0);
?>
This will replace {check0} with a empty string; you could replace '' with 'not checked' or some other value if you prefer.
There is a much more complex example if you search here on 'rucola' (it was for a restaurant).
You can change the array handling by turning off 'Let ChronoForms handle my arrays' and instead using code like this in the OnSubmit Beofer Email box.
<?php
$check1 = JRequest::getVar('check1', array(), 'post', 'array');
$check1 = implode('<br />', $check1);
JRequest::setVar('check1', $check1);
?>
Bob
Thanks that worked great.
I have a number of checkboxes on the form, could you tell me the correct way to setup a function and call it instead of having the same lines of code?
Currently I am using:
Thanks for your time, I really appreciate it
Warren
I have a number of checkboxes on the form, could you tell me the correct way to setup a function and call it instead of having the same lines of code?
Currently I am using:
$check2 = JRequest::getVar('check2', '', 'post');
if (!empty($check2)) {
JRequest::setVar('check2', 'Yes');
}
else{
JRequest::setVar('check2', $check2);
}
Thanks for your time, I really appreciate it
Warren
This topic is locked and no more replies can be posted.