Dynamic options for dropdowns and multi selection fields

Discover how to load Dropdowns and Checkboxes options from your Database or other dynamic sources in your Joomla form using ChronoForms8.

Here is how to setup the Dynamic Options behavior for the dropdown fields and multi selection fields in ChronoForms v8, the same setup can be used for Chronoforms v7

Start by preparing your options array, your can do this using:

  1. PHP action if your have a static or complex source of data
  2. Read Data action action if your options are coming from the database directly

We will use a PHP action here:

Dynamic options for dropdowns and multi selection fields image 1

The PHP actions will return an array with options values and texts

Next, enable the Dynamic Options behavior in your dropdown and set the Data Source as {var:php25}, which in this case is the returned value from PHP action named "php25", the action we have just created

We will also need to set the Option value path to: {row:value} and the Option value text to {row:text} as this is the path for the values and texts in our array:

Dynamic options for dropdowns and multi selection fields image 2

You may add any default options to the Options box, those will appear before the dynamic options

if you have ChronoForms v8.0.47 or later, you may also use {row:key} and {row:value} if your values are a single dimension array, coming from a JSON array in the database for example:

Dynamic options for dropdowns and multi selection fields image 3

in this case {row:key} will hold the numeric value index, and {row:value} will hold the value itself

Category: ChronoForms v8

VPS & Email Hosting 20% discount
hostinger