1. The 3.8 code for Fabrik is now available on github, in the 'master' branch. If you are familiar with updating Fabrik from github, we would appreciate it if you could test this code on J! 3.8 for us. Once we have some feedback, we'll build a 3.8 release.

Dropdown element

Mar 26, 2017
Dropdown element

  • Settings (top)


    Sub Elements (top)

    • Add - Press this to add in a new drop down option
    • Value - The value that is stored in the database if the drop down option is selected
    • Label - The label that appears next to the drop down option. Equally this label is shown in the table view rather than the recorded value (which is stored in the database table itself)
    • Default - is the option selected as default
    • Delete - Press this to delete the drop down option
    Note:You can reorder the sub elements by clicking down on the grey bar to the left of the value field and dragging it within the list.

    Note: to create dropdown's with <optgroup>'s add a sub element with a value of '<optgroup>', the sub element label will be used as the dropdown optgroup heading. (since 25/11/2013)

    Options (top)

    • Multiple selections - if yes then uses can ctrl click to select multiple options from the list
    • Multiple selections height - if multiple selections turned on then this value represents how many options are visible in the list before you have to start scrolling it
    • Eval - evaluate the label as a PHP function.
    • Default - The default value to populate the element with. If the eval option is selected then this should contain a PHP statement

    Add Options (top)

    • Allow user to add drop down option - Allow your form's users to add in additional options to your form.
    • Only add label - If no selected then the user has to enter both a value and a label for the checkbox option they are adding. If yes selected then only a label field is presented to the user the value of which is then used for the value and label.
    • Save new additions - If yes selected then the newly submitted option is stored by the element, meaning subsequent users of the form will be able to select the same value.

    Advanced (top)

    • Separator - to be completed
    • Eval Populate - Insert PHP code to build the options. Should return an array of JHTML select options. See sample below. Also on radio button element. Examples of use can be found there and below.
    • Eval - to be completed
    • Default - to be completed
    Sample Eval Populate
    Code (Text):
    $options[] = JHTML::_('select.option', '0', 'Please select' );
    $db = JFactory::getDbo();
    $db->setQuery("SELECT id, text FROM #__tablename");
    $rows = $db -> loadObjectList();
    foreach ($rows as $row) {
        $options[] = JHTML::_('select.option', $row->id, $row->text);
    return $options;
    NOTE: Fabrik assumes the select IDs to be strings. Notice the first select option has the zero in quotes. Failing to do this will break the proper display of the value in a list view.
  • Loading...