I use the webform module to build a form. I'd like to fill a select with values coming from a database. I use the hook

Here is some sample code:

     * Implementation of hook_webform_select_options_info().
     * See webform/webform_hooks.php for further information on this hook in the Webform API.
    function custom_webform_pre_build_list_webform_select_options_info() {
        $items = array();
        $items['user_roles'] = array(
            'title' => t('Roles'),
            'options callback' => 'custom_webform_pre_build_list_user_roles'

       return $items;

     * Build an options list to be used with webforms select list based in drupal roles
    function custom_webform_pre_build_list_user_roles() {
        $roles = user_roles();

        $contentarray = array();

        $contentarray[0] = t("Select user role");

            #$new_taxonomies = array();
            foreach ($roles as $role) {
                $contentarray[$role] = t($role);

        return $contentarray;

I activated the module. Now my problem is to select this list of entries for my select. I cannot see the "Load a pre-built option list" when I click "Add" under "options" for the select box in the form builder. What am I doing wrong?

I'm using version 3.x of webform and the "Options element" module.

Thx, Sven

1 Answer 1


I had the formbuilder module activated. There is no possibility to "Load a pre-built option list"! I deactivated it then it works. The problem is, there is not a nice builder ui anymore ;-(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.