function getCurrentValue($template_instance_query_values, $form_submitted, $source_is_page)
 {
     // Get the value from the request, if
     // it's there, and if it's not an array.
     $cur_value = null;
     $field_name = $this->template_field->getFieldName();
     $delimiter = $this->mFieldArgs['delimiter'];
     $escaped_field_name = str_replace("'", "\\'", $field_name);
     if (isset($template_instance_query_values) && $template_instance_query_values != null && is_array($template_instance_query_values)) {
         // If the field name contains an apostrophe, the array
         // sometimes has the apostrophe escaped, and sometimes
         // not. For now, just check for both versions.
         // @TODO - figure this out.
         $field_query_val = null;
         if (array_key_exists($escaped_field_name, $template_instance_query_values)) {
             $field_query_val = $template_instance_query_values[$escaped_field_name];
         } elseif (array_key_exists($field_name, $template_instance_query_values)) {
             $field_query_val = $template_instance_query_values[$field_name];
         }
         if ($form_submitted && $field_query_val != '') {
             $map_field = false;
             if (array_key_exists('map_field', $template_instance_query_values) && array_key_exists($field_name, $template_instance_query_values['map_field'])) {
                 $map_field = true;
             }
             if (is_array($field_query_val)) {
                 $cur_values = array();
                 if ($map_field && !is_null($this->mPossibleValues)) {
                     $cur_values = array();
                     foreach ($field_query_val as $key => $val) {
                         $val = trim($val);
                         if ($key === 'is_list') {
                             $cur_values[$key] = $val;
                         } else {
                             $cur_values[] = SFUtils::labelToValue($val, $this->mPossibleValues);
                         }
                     }
                 } else {
                     foreach ($field_query_val as $key => $val) {
                         $cur_values[$key] = $val;
                     }
                 }
                 return SFFormPrinter::getStringFromPassedInArray($cur_values, $delimiter);
             } else {
                 $field_query_val = trim($field_query_val);
                 if ($map_field && !is_null($this->mPossibleValues)) {
                     // this should be replaced with an input type neutral way of
                     // figuring out if this scalar input type is a list
                     if ($this->mInputType == "tokens") {
                         $is_list = true;
                     }
                     if ($is_list) {
                         $cur_values = array_map('trim', explode($delimiter, $field_query_val));
                         foreach ($cur_values as $key => $value) {
                             $cur_values[$key] = SFUtils::labelToValue($value, $this->mPossibleValues);
                         }
                         return implode($delimiter, $cur_values);
                     }
                     return SFUtils::labelToValue($field_query_val, $this->mPossibleValues);
                 }
                 return $field_query_val;
             }
         }
         if (!$form_submitted && $field_query_val != '') {
             if (is_array($field_query_val)) {
                 return SFFormPrinter::getStringFromPassedInArray($field_query_val, $delimiter);
             }
             return $field_query_val;
         }
     }
     if (!$source_is_page && empty($cur_value) && !$form_submitted) {
         if (!is_null($this->mDefaultValue)) {
             // Set to the default value specified in the form, if it's there.
             return $this->mDefaultValue;
         } elseif ($this->mPreloadPage) {
             return SFFormUtils::getPreloadedText($this->mPreloadPage);
         }
     }
     return $cur_value;
     // null
 }