$options = [];$options[] = ['value' => '', 'text' => '請選擇'];
$options[] = ['value' => '1', 'text' => '1'];
$options[] = ['value' => '2', 'text' => '2'];
$this->data['dropdown_Type'] = $options;
This is my PHP code, I Want to set dropdown List in PHP at page Load,But it is not successful and effective.
you need this code in a PHP action ABOVE the Dropdown field, then you need to configure your dropdown like this:
where "php_name" is the name of your PHP action, also your code should be like this:
$options = [];
$options[] = ['value' => '', 'text' => '請選擇'];
$options[] = ['value' => '1', 'text' => '1'];
$options[] = ['value' => '2', 'text' => '2'];
return $options;
tutorial here:
You need to login to be able to post a reply.