diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 9705d54d4cd2666ff6e1084ef8e81e8a33a56291..427420a821d58489518b9746c0f2fc6bd3b9009a 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -941,7 +941,7 @@ class SelectionField extends FormField { } class SelectionWidget extends ChoicesWidget { - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); $value = false; if ($this->value instanceof DynamicListItem) { @@ -953,9 +953,9 @@ class SelectionWidget extends ChoicesWidget { $value = $this->value; $name = $this->getEnteredValue(); } - if (!$config['typeahead']) { + if (!$config['typeahead'] || $mode=='search') { $this->value = $value; - return parent::render(); + return parent::render($mode); } $source = array(); diff --git a/include/class.forms.php b/include/class.forms.php index 07860b9966159f3a5cff38fcf13c915583a41076..58e250d4950c254f6bbe9bde0d21c26e15286ba4 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -967,20 +967,27 @@ class PhoneNumberWidget extends Widget { } class ChoicesWidget extends Widget { - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); // Determine the value for the default (the one listed if nothing is // selected) $choices = $this->field->getChoices(); - $def_key = $this->field->get('default'); - if (!$def_key && $config['default']) - $def_key = $config['default']; - $have_def = isset($choices[$def_key]); - if (!$have_def) + // We don't consider the 'default' when rendering in 'search' mode + $have_def = false; + if ($mode != 'search') { + $def_key = $this->field->get('default'); + if (!$def_key && $config['default']) + $def_key = $config['default']; + $have_def = isset($choices[$def_key]); + if (!$have_def) + $def_val = ($config['prompt']) + ? $config['prompt'] : 'Select'; + else + $def_val = $choices[$def_key]; + } else { $def_val = ($config['prompt']) - ? $config['prompt'] : 'Select'; - else - $def_val = $choices[$def_key]; + ? $config['prompt'] : 'Select'; + } $value = $this->value; if ($value === null && $have_def) $value = $def_key; diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 6435451b923da826c41c7ea93f7f97893eb09cad..a48f1525651f17f1ead5f58cdca255cba23de13e 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -617,7 +617,8 @@ if ($results) { elseif (!$f->hasData()) continue; ?><label><?php echo $f->getLabel(); ?>:</label> - <div style="display:inline-block;width: 12.5em;"><?php $f->render(); ?></div> + <div style="display:inline-block;width: 12.5em;"><?php + $f->render('search'); ?></div> <?php } ?> </fieldset> <p>