Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: None
-
Fix Version/s: 1.2
-
Component/s: None
-
Labels:None
Description
Users need a way to configure the display layout for custom checkbox and radio button options. Currently, all options are output inline (with a space delimiter between each option).
1. Configuration (Admin -> Custom Data -> Add/Edit Custom Field:
- add new property to civicrm_custom_field table - options_per_line (int, nullable)
- add new input field which displays only if html_type = Checkbox or Radio
-+ label = Number of Options Per Line
2. Edit/View Custom Data (contact/view/cd AND user/register + user/edit profile forms)
- if options_per_line for the field is > 1, generate a table layout for the field options with $options_per_line cells per row and a checkbox element + label in each cell.
Example: If options_per_line = 3, and I have 5 options, the layout would be -
<dt>Field Label</dt>
<dd>
<table class=form-layout><tr><td><input type=checkbox.../> Red</td><td><input type=checkbox../> Green</td><input type=checkbox ../> Blue</td></tr><tr>...2nd row with remaining 2 options ...</tr></table></dd>
NOTE: Currently we use the Quickform addGroup function to insert a set of checkbox or radio options into a form. As far as I know, this function only supports passing a single option separator (e..g '<br />', or ' '). So we may need to bypass this function and generate the table layout in the tpl (as I think we have done for the checkboxes which are listed in the scrolling divs for Search -> Select Group ...).