"Afghanistan",),array("ISO" => "AL", "NAME" => "Albania",),array("ISO" => "DZ", "NAME" => "Algeria",),);$form->data['my_option']=$country;?>The dynamic data settings for the dropdown are:Data Path: my_optionValue key: ISOText key: NAMEWhat is missing? I always get an empt dropdown...regardsFlorian"> dynamic data dropdown - Forums

Forums

dynamic data dropdown

florian030 24 Jul, 2015
Hi,

i try to create a dynamic data for a dropdown-list according to https://www.chronoengine.com/faqs/58-cfv4/cfv4-elements-and-html/2647-how-do-i-build-a-select-drop-down-radio-button-or-checkbox-group.html.

I use a custum code in onLoad:
<?php
$countries=array(
array("ISO" => "AF", "NAME" => "Afghanistan",),
array("ISO" => "AL", "NAME" => "Albania",),
array("ISO" => "DZ", "NAME" => "Algeria",),
);
$form->data['my_option']=$country;
?>


The dynamic data settings for the dropdown are:
Data Path: my_option
Value key: ISO
Text key: NAME

What is missing? I always get an empt dropdown...

regards
Florian
GreyHead 24 Jul, 2015
Hi Florian,

You have $countries in one place and $country in the other.

Bob
florian030 24 Jul, 2015
Hi Bob,
this is just a typo in my post.

I have $country=array and $form->data['my_option']=$country;

regards
Florian
florian030 24 Jul, 2015
Got it๐Ÿ˜‰ You must load the custom-code before HTML (Render Form).
This topic is locked and no more replies can be posted.