Last active
August 29, 2015 14:13
-
-
Save alexweissman/503f47d375000fb5e549 to your computer and use it in GitHub Desktop.
Example loading a dropdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user_choices = []; | |
if (checkActionPermission('loadUsers', array())) { | |
if (($users = loadUsers()) === false) { | |
apiReturnError($ajax, ACCOUNT_ROOT); | |
} | |
foreach ($users as $user_id => $user){ | |
$user_choices[$user_id] = $user['display_name'] . " (" . $user['user_name'] . ")"; | |
} | |
} | |
$fields = [ | |
"user_dropdown" => [ | |
"type" => "select", | |
"label" => "Select user", | |
"display" => 'show', | |
"icon" => "fa fa-user", | |
"choices" => $user_choices, | |
"placeholder" => "Select user", | |
'validator' => [ | |
'selected' => true, | |
'label' => 'Select user' | |
] | |
] | |
]; | |
$template = "{{user_dropdown}}"; | |
$fb = new FormBuilder($template, $fields, [], []); | |
echo $fb->render(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment