1. "Fabrik 4" helpers needed!

    You are invited to join other community members active in coding, maintaining and improving Fabrik. Please visit https://fabrik.help for more information!
    Dismiss Notice

Radio Button element

May 7, 2020
Radio Button element

  • Introduction(top)

    Renders a a series of radio input options.

    Details Tab(top)

    Options (top)

    • Sub Options - The list of options for the radio buttons. Use the green + to add more, the red - to remove options and the grey boxes on the right to drag and drop to change the order.
      NOTE: options can be programmatically added to this list using Eval Populate on the Advanced tab.
      • 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
    • Options per row - Specify the number of columns used to render the radio buttons. A smaller number will place the options FARTHER apart. If you have short options, then choosing a number like 8 would help move the options closer together without as much whitespace between them.
    • Button group - Renders the options as a bootstrap 'button group' vs. the traditional html radio buttons (a button group is similar to the No/Yes choice of button group).
      • Button groups work only on Joomla 3 (with bootstrap)
      • If you use javascript events, you have to use a click event (and not the change event).

    Front End Addition (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 Options(top)

    • Eval Populate - PHP that can generate a list of options to add to list added using JHTML.
      See also the dropdown element
    • For example, here is some code that will build a list of years from the current year and the previous 10 years.
      for ($year = date('Y'); $year > date('Y', strtotime('-10 years')); $year--) {
        $options[] = JHTML::_('select.option',$year,$year); }
      return $options;
    • Note: There is no way to specify a default selected option using this method.

    Additional data(top)

    Sometimes, when editing a record, you may see sub-options appearing that are not listed in the element's admin page. This is because the current record has values that are not found in the sub-options. This could occur because:
    • Data was entered manually into the database
    • Data previously entered from a radio sub option that has been subsequently deleted
    • The user has been allowed (possibly at some point) to add their own options but not set to store that added option as a option available to other users.
    With Fabrik we work on the principle of trying to be as lenient as possible with the data stored/displayed. If someone has entered it in, we will try to to produce processes where it will be not removed.
  • Loading...