Child pages
  • Adding columnized output support to "PredefinedOptions" tag [5.2.1-RC1]
Skip to end of metadata
Go to start of metadata

The "PredefinedOptions" tag is the core of all form controls, where user can select something from predefined set of options. For example:

  • inp_edit_options - dropdown with a list of options
  • inp_edit_radio - list of radio buttons
  • inp_edit_checkboxes - list of checkboxes, where multiple checkboxes can be selected at once

The tag is good at what it does, but when it comes to more advanced stuff (see list below), then it's pretty hard to it.

  • displaying list of options split across several columns
  • displaying only selected options
  • both from above combined
Typical PredefinedOptions tag usage the in template
<inp2:m_DefineElement name="checkbox_option_element">
	<li>
		<inp2:m_Param name="option"/>
	</li>
</inp2:m_DefineElement>
 
<ul>
	<inp2:unit-prefix_PredefinedOptions field="FieldName" block="checkbox_option_element" selected="selected"/>
</ul>

Parameters added for "PedefinedOptions" tag

Parameter NameParameter Description
selected_onlydisplay only selected options (without this all options will be displayed)
columnsindicate column count to split displayed options into

Also now the "selected" parameter default to "selected" value, when no given explicitly in tag. This would allow to write less code to do same task as before.

Parameters added to block, specified in "block" parameter to "PredefinedOptions" tag

Parameter NameParameter Description
column_numbercurrently printed column number
column_changedflag, that is only set when a column change occurs (let "block" to decide how to handle that)
option_numberorder number of the option in the list (starting from 1)
option_counttotal option count that will be printed

Usage examples

For we're having following options list:

Option KeyOption Title
100Option One
200Option Two
300Option Three
400Option Four
500Option Five
Using "columns", "column_changed" and "column_number" parameters
<inp2:m_DefineElement name="checkbox_option_element">
	<inp2:m_if check="m_Param" name="column_changed">
		</ul>
		<ul class="column-<inp2:m_Param name='column_number'/>">
	</inp2:m_if>
	<li>
		<inp2:m_Param name="option_number"/>. <inp2:m_Param name="option"/> (key: <inp2:m_Param name="key"/>)
	</li>
</inp2:m_DefineElement>

<ul class="column-1">
	<inp2:unit-prefix_PredefinedOptions field="FieldName" block="checkbox_option_element" columns="3"/>
<ul>

The example from above would produce following output:

<ul class="column-1">
	<li>1. Option One (key: 100)</li>
	<li>2. Option Two (key: 200)</li>
<ul>

<ul class="column-2">
	<li>3. Option Three (key: 300)</li>
	<li>4. Option Four (key: 400)</li>
<ul>

<ul class="column-3">
	<li>5. Option Five (key: 500)</li>
<ul>

predefinedoptions_multicolumn_display_53x_feat.patch

predefinedoptions_multicolumn_display_52x_feat.patch

Related Tasks

INP-1340 - Getting issue details... STATUS