by Captivea - SugarCRM Advanced Partner

Turn multiple select fields into checkboxes. Long drop-downs are a nightmare to use when a list gets beyond a few options. Make your SugarCRM users' lives simplier by transforming these painful fields into a list of checkboxes with just a single line of code, thanks to this add-on.

Includes a 30 day guarantee
Try it Now

By clicking you consent to share your profile with the developer

Developer Guide

Field type supported

Please note that only "multiselect" fields are supported, you can't convert a dropdown into checkboxes, the values will not be saved upon runtime !

You can create custom fields in studio or convert the stock's multiselect fields of sugarcrm.

Locate the metadata files

  • If you have already used Studio or customized your module, the files should be located in /custom/modules/< yourmodule >/metadata/
  • Else you can either go to studio / your module / layout / edit view / save & deploy, or copy files from /modules/< yourmodule >/metadata/ to custom/modules/< yourmodule >/metadata/

Configure the metadata files

  • Open editviewdefs.php
  • Locate the multienum field you want to customize :
'LBL_PANEL' => 
      array (
        0 => 
        array (
          0 => 
          array (
            'name' => 'multienumfield_name',
            'studio' => 'visible',
            'label' => 'LBL_MULTIENUMFIELD_NAME',
          ),
          1=> null,
        ),
    ),
  • Simply override the type parameter (or add it if missing) :
'LBL_PANEL' => 
      array (
        0 => 
        array (
          0 => 
          array (
            'name' => 'multienumfield_name',
            'type' => 'multienum_checked', // TYPE INFORMATION OVERRIDE HERE
            'studio' => 'visible',
            'label' => 'LBL_MULTIENUMFIELD_NAME',
          ),
          1=> null,
        ),
    ),

Results: Result

Options / Additional parameters

Our module support a large number of options that are defined as displayParams parameters inside editviewdefs.php

Basic Options

Parameter Name Data Type Description
cols integer Number of columns to display the option list. Default : 2 columns
rows integer Number max of rows displayed. If extra rows are needed to display the full list of options, a scrolling panel will be created (using CSS3)
select_buttons boolean (true/false) If true, display select all / unselect all buttons below the options list
folding boolean (true/false) If true, display collapse / expand buttons (only if select_buttons param is set to true)
display_summary boolean (true/false) If true, display a summary area at the bottom of the field that display currently selected values (like on the detail view)
popup string ("LBL_MOD_xxxx") By default: empty. If not empty, display a button that will open a popup to let the user select the options (generally prefered when there's a really long list of options, it keep the edit view simple without a long scrolling area). The LBL string is the text of the button and can be a reference to the SugaCRM module language file. Thus it can be internationalized using standard sugarcrm mecanism
sort string (none / asc / desc) By default: none. If defined, sort the option list using the labels alphabetical orders (not the keys!)
align string (left / right / center) By default: left. If defined, set the alignement of the checkboxes within the form's cell.

Rendering

cols = "4" Result

select_buttons = true Result

display_summary = true Result

popup = "SELECT OPTIONS" Result

Groups

If you have a long list of options in your dropdown it can be useful to group those options in logical groups. Users can then select options in any of these groups. You can define the name for each group and which options belong in it as well.

Please note however that for a consistent look and feel, each group have the same rows/cols values.

Groups are defined like basic options in displayParams with the key "row_groups". The data type is array. Each value of the array represents a separated group. As we have multiple options to be defined on each group, the datatype of each array's value is also an array.

Parameter Name Data Type Description
row_groups Array of Array Creates groups of options from the options list's values. The array is containing as many array as groups need to be created (see below).

Group options

Here is the list of options supported inside each entry of row_groups array :

Parameter Name Data Type Description
name string Id of the generated group (used in HTML). Keep it unique ! (and like every ID avoid spaces and no a-z / A-Z / 0 - 9 characters)
options array (string) array of the multienum options list's keys you want to see inside this group
title string ("LBL_MOD_xxxx") Name of the group displayed. Can be a label defined in module's language file
select_buttons boolean (true/false) If true, display select all / unselect all buttons below the group
sort string (none / asc / desc) By default: none. If defined, sort the option list using the labels alphabetical orders (not the keys!)
align string (left / right / center) By default: left. If defined, set the alignement of the checkboxes within the form's cell.
folding boolean (true/false) If true, display collapse / expand buttons near group's name
fold boolean (true/false) If true, the group is collapsed by default. (default: false Needs folding set to true)

Automatically generate Groups from the options list

Over time using SugarCRM you will find that you will be creating or deleting options from the list. We've kept this in mind when creating this solution.

Our module can automatically generate the groups, by reading the options list's keys and by looking for a certain key. Each options below the category entry will then added to the created group.

To do that, don't specify "row_groups" key as done above, but use the "row_groups_auto" option instead.

Parameter Name Data Type Description
row_groups_auto Array Creates groups automatically from the option list

To configure the algorithm used to create groups, you can use the following parameters to be defined inside row_groups_auto table :

Parameter Name Data Type Description
option_value_tag String Enter the string, every category/group's keys will match to. For exemple : "category--". The remaining part of the option key will be the ID of the group, and then the value/label of the option will be displayed as the group's name
select_buttons boolean (true/false) If true, display select all / unselect all buttons below the groups
folding boolean (true/false) If true, display collapse / expand buttons near groups' names
fold boolean (true/false) If true, groups will be collapsed by default. (default: false. Needs folding set to true)

Remarks :

  • Each option in the list used to declare a group or category with option_value_tag will only create a group label. NOT a checkbox, too. This is for display purposes only
  • Each group generated needs at least one element inside the group to let the module works properly
  • Sorting and Alignment options are inherited from the globals options

Code Example :

Field's declaration in Editviewdefs.php :

0 =>
          array (
            'name' => 'sector',
            'label' => 'LBL_SECTOR',
            'type' => 'multienum_checked',
            'displayParams' =>
            array (
              'cols' => 4,
              'rows' => 6,
              'select_buttons' => true,
              'folding' => true,
              'display_summary' => true,
              'align' => 'left',
              'popup' => 'LBL_MODIFY_SECTORS',
              'row_groups_auto' => array (
                'option_value_tag' => 'cat--',
                'select_buttons' => true,
                'folding' => true,
                'fold' => true,
              ),
            ),
          ),

Option list (defined in studio) :

$app_list_strings['industry_dom']=array (
    '' => '',
    'cat--basic_materials' => 'BASIC MATERIALS',
    'chemicals' => 'Chemicals',
    'mining' => 'Mining',
    'cat--communications' => 'COMMUNICATIONS',
    'internet' => 'Internet',
    'telecommunications' => 'Telecommunications',
    'cat--energy_-_utilities' => 'ENERGY - UTILITIES',
    'coal' => 'Coal',
    'energy-alternate_sources' => 'Energy-Alternate Sources',
    'oilgas' => 'Oil&Gas',
    'water' => 'Water',
    'cat--industrial' => 'INDUSTRIAL',
    'aerospacedefense' => 'Aerospace/Defense',
    'electronics' => 'Electronics',
    'environmental_control' => 'Environmental Control',
    'shipbuilding' => 'Shipbuilding',
    'cat--technology' => 'TECHNOLOGY',
    'computers' => 'Computers',
    'software' => 'Software',
);

In this sample, we will get 4 categories : *BASIC MATERIALS *ENERGY - UTILITIES *INDUSTRIAL *TECHNOLOGY

Result

Saving Comment Saving Comment...