Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With the type dropdown you display a set of choices (defined in the property settings as key/value pairs), the keys are stored in the DB column.

Note: The type ‘radio’ radioworks the same way with the same settings and displays the choices as radio buttons.

...

Typical Property Settings Array

Code Block
languagephp
$propDefs['question_type'] = array (
	'name'=>'question_type',
	'label'=>KText::_('FIELD_LABEL_QUESTION_TYPE'),
	'type'=>'dropdown',
	'choices'=>array(
		'textbox' => KText::_('As text box'),
		'textarea' => KText::_('As multi line text box'),
		'checkbox' => KText::_('As checkbox'),
		'radiobuttons' => KText::_('As radio buttons'),
		'dropdown' => KText::_('As dropdown'),
		'upload' => KText::_('As file upload'),
		'calendar' => KText::_('As calendar'),
		'colorpicker' => KText::_('As color picker'),
		'ralcolorpicker' => KText::_('As RAL color picker'),
		'images' => KText::_('As clickable images'),
		'slider' => KText::_('As slider'),
		'choices' => KText::_('As choices plus text field'),
	),
	'default'=>'textbox',
	'positionForm'=>6000,
);

Property settings

choices

Required: yes
Valid Values: associative array of strings - keys are what’s stored in the column, values are displayed in the dropdown

default

Required: no
Valid values: string (one of the keys in the ‘choices’ setting)

...