Forums

Checkboxes in Custom HTML field

hanerlich 31 Jan, 2023
Hello,
i want checkboxes in 5 columns and 10 rows (50 checkboxes). I tried it in the HTML field and it is displayed in the frontend. After sending, the field in the email is empty.
Is there a solution?
Max_admin 17 Feb, 2023
You may use Custom HTML or 10 checkboxes groups elements

if you use HTML then you need to use a PHP action before the email to loop over the data and build the checkboxes value list then get it in the email body using
{var:php_action_name}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hanerlich 17 Feb, 2023
Hi Max,
that sounds good, but I have no idea where to place the php action.
Max_admin 19 Feb, 2023
Before the email action in the 2nd form page, build the output you need, then return it:

$x = 111;
return $x;

if your PHP action name is php_2 then you can get the $x value in the email body as {var:php_2}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hanerlich 19 Feb, 2023
Hi Max,
unfortunately I have no idea about php, could you please give me a simple example with 3 checkboxes
value="1"
value="2"
value="3"
My PHP action name is php_27
I would be very happy if this worked.
Max_admin 20 Feb, 2023

$output = "";
foreach($this->data("checkboxes_name") as $k => $v){
$output .= "\n".$v;
}

return $output;


This will return a multiline list of the checkboxes selected in your list, you can then use it in your Email, or change the formatting in the PHP code.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hanerlich 20 Feb, 2023
Hi Max,
my Custom HTML now looks like this, including advanced settings: run php.
But in the email I receive there is no reference to checkboxes 25.

<div class="mainfield field grouped fields required" data-validationrules='{"identifier":"checkboxes_25_1","rules":[{"type":"minChecked[1]","prompt":"This field is required"}]}' data-vtype="checkboxes" data-uid="25" data-isinput="1">
<label for="checkboxes_25">Checkboxes 25</label><div class="field">
<div class="ui checkbox checkbox" style="margin:0;"><input type="checkbox" value="1" name="checkboxes_25[]" id="checkboxes_25_1" />
<label for="checkboxes_25_1">Option 1</label></div></div><div class="field">
<div class="ui checkbox checkbox" style="margin:0;"><input type="checkbox" value="2" name="checkboxes_25[]" id="checkboxes_25_2" />
<label for="checkboxes_25_2">Option 2</label></div></div><div class="field">
<div class="ui checkbox checkbox" style="margin:0;"><input type="checkbox" value="3" name="checkboxes_25[]" id="checkboxes_25_3" />
<label for="checkboxes_25_3">Option 3</label></div></div></div>


$output = "";
foreach($this->data("checkboxes_25") as $k => $v){
$output .= "\n".$v;
}
return $output;
Max_admin 20 Feb, 2023
Did you add {var:php_27} to the email body ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hanerlich 20 Feb, 2023
Hi Max,
yes sure, i tested both variations you described, also with the {var:php_27} at the body of the Custom HTML.
You need to login to be able to post a reply.