single checkbox dynamic setting

How to set up a single checkbox with dynamic values from a database.

Overview

The issue occurs when using a custom PHP array to populate a checkbox, which may not be correctly interpreted by the form.
Instead of custom PHP code, directly reference the database fields in the checkbox's label and value settings using the Read Data variable syntax.

Answered
ChronoForms v8
kr kraadde 01 Jun, 2025

How to setup a single checkbox where the value and the text are dynamically taken from a db field?

I tried using a php99: 

$options = [    ['value' => $this->data("datum_1"), 'text' => $this->data("datum_1")],

];return $options;

and the value set to {var:php99} but the checkbox has no valeu and no text attached although the debugger shows:

 [php99] => Array
        (
            [0] => Array
                (
                    [value] => 2025-07-23
                    [text] => 2025-07-23
                )

        )

.

Max_admin Max_admin 02 Jun, 2025
Answer

The easiest way is to call the Read Data variable in the Checkbox label and value fields:

Label: {var:read_data_name.field_name}

Value: {var:read_data_name.field2_name}

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Post a Reply