private function _show_validation_messages($template)
 {
     $Perch = Perch::fetch();
     $errors = $Perch->get_form_errors($this->form_id);
     if (PerchUtil::count($errors)) {
         // General error message
         $template = $this->_render_error_message($template, 'all', 'general');
         foreach ($errors as $fieldID => $type) {
             $template = $this->_render_error_message($template, $fieldID, $type);
         }
     } else {
         // no errors!
         if (strpos($template, '<perch:success') != false) {
             $s = '/(<perch:success[^>]*>)((?!perch:success).*?)(?:<\\/perch:success>)/s';
             $count = preg_match($s, $template, $match);
             if ($count) {
                 $Tag = new PerchXMLTag($match[1]);
                 if ($Tag->show_form()) {
                     $template = str_replace($match[0], $match[2], $template);
                     return $this->_strip_all_errors($template);
                 }
                 return $match[2];
             }
         }
     }
     return $this->_strip_all_errors($template);
 }