From b1b73761940d7928d4c7fff8da4e37cb896228ec Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 4 Sep 2014 16:08:00 -0500
Subject: [PATCH] forms: Always attempt to look up selection value by name

---
 include/class.dynamic_forms.php | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index fcbeeb897..5cf90a011 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -1169,11 +1169,12 @@ class SelectionField extends FormField {
     function parse($value) {
         $config = $this->getConfiguration();
         if (is_int($value))
-            return $this->to_php($this->getWidget()->getEnteredValue(), (int) $value);
+            $val = $this->to_php($this->getWidget()->getEnteredValue(), (int) $value);
         elseif (!$config['typeahead'])
-            return $this->to_php(null, (int) $value);
-        else
-            return $this->to_php($value);
+            $val = $this->to_php(null, (int) $value);
+        if (!$val)
+            $val = $this->to_php($value);
+        return $val;
     }
 
     function to_php($value, $id=false) {
-- 
GitLab