function saveEventRegistrationRequest($data, Form $form) { // Check if the honeypot has been filled out if (@$data['username']) { SS_Log::log(sprintf('EventRegistrationRequestForm honeypot triggered (data: %s)', http_build_query($data)), SS_Log::NOTICE); return $this->httpError(403); } try { $this->event_registration_request_manager->registerEventRegistrationRequest($data); Session::clear("FormInfo.Form_EventRegistrationRequestForm.data"); $form->clearMessage(); return $this->redirect($this->Link('?saved=1')); } catch (EntityValidationException $ex1) { $messages = $ex1->getMessages(); $msg = $messages[0]; $form->addErrorMessage('City', $msg['message'], 'bad'); SS_Log::log($msg['message'], SS_Log::ERR); // Load errors into session and post back Session::set("FormInfo.Form_EventRegistrationRequestForm.data", $data); return $this->redirectBack(); } catch (Exception $ex) { $form->addErrorMessage('Title', 'Server Error', 'bad'); SS_Log::log($ex->getMessage(), SS_Log::ERR); // Load errors into session and post back Session::set("FormInfo.Form_EventRegistrationRequestForm.data", $data); return $this->redirectBack(); } }