Skip to content
Snippets Groups Projects
Commit 7490fbf3 authored by Peter Rotich's avatar Peter Rotich
Browse files

Only show multiselect option on dropdown selection

Hide multi selection option for typeahead selections
parent 37e51e3b
Branches
Tags
No related merge requests found
...@@ -1064,8 +1064,9 @@ class SelectionField extends FormField { ...@@ -1064,8 +1064,9 @@ class SelectionField extends FormField {
function getConfigurationOptions() { function getConfigurationOptions() {
return array( return array(
'widget' => new ChoiceField(array( 'widget' => new ChoiceField(array(
'id'=>1, 'label'=>__('Widget'), 'required'=>false, 'id'=>1,
'default' => 'dropdown', 'label'=>__('Widget'),
'required'=>false, 'default' => 'dropdown',
'choices'=>array( 'choices'=>array(
'dropdown' => __('Drop Down'), 'dropdown' => __('Drop Down'),
'typeahead' =>__('Typeahead'), 'typeahead' =>__('Typeahead'),
...@@ -1076,14 +1077,19 @@ class SelectionField extends FormField { ...@@ -1076,14 +1077,19 @@ class SelectionField extends FormField {
'hint'=>__('Typeahead will work better for large lists') 'hint'=>__('Typeahead will work better for large lists')
)), )),
'multiselect' => new BooleanField(array( 'multiselect' => new BooleanField(array(
'id'=>1, 'label'=>__(/* Type of widget allowing multiple selections */ 'Multiselect'), 'id'=>2,
'label'=>__(/* Type of widget allowing multiple selections */ 'Multiselect'),
'required'=>false, 'default'=>false, 'required'=>false, 'default'=>false,
'configuration'=>array( 'configuration'=>array(
'desc'=>__('Allow multiple selections')), 'desc'=>__('Allow multiple selections')),
'hint' => __('Dropdown only'), 'visibility' => new VisibilityConstraint(
new Q(array('widget__eq'=>'dropdown')),
VisibilityConstraint::HIDDEN
),
)), )),
'prompt' => new TextboxField(array( 'prompt' => new TextboxField(array(
'id'=>2, 'label'=>__('Prompt'), 'required'=>false, 'default'=>'', 'id'=>3,
'label'=>__('Prompt'), 'required'=>false, 'default'=>'',
'hint'=>__('Leading text shown before a value is selected'), 'hint'=>__('Leading text shown before a value is selected'),
'configuration'=>array('size'=>40, 'length'=>40), 'configuration'=>array('size'=>40, 'length'=>40),
)), )),
......
...@@ -611,9 +611,9 @@ class FormField { ...@@ -611,9 +611,9 @@ class FormField {
$T = new $clazz(); $T = new $clazz();
$config = $this->getConfiguration(); $config = $this->getConfiguration();
$this->_cform = new Form($T->getConfigurationOptions(), $source); $this->_cform = new Form($T->getConfigurationOptions(), $source);
if (!$source && $config) { if (!$source) {
foreach ($this->_cform->getFields() as $name=>$f) { foreach ($this->_cform->getFields() as $name=>$f) {
if (isset($config[$name])) if ($config && isset($config[$name]))
$f->value = $config[$name]; $f->value = $config[$name];
elseif ($f->get('default')) elseif ($f->get('default'))
$f->value = $f->get('default'); $f->value = $f->get('default');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment