public function savenewsletter($urlParams, $form) { $id = $_REQUEST['ID']; $className = 'Newsletter'; if (defined('DB::USE_ANSI_SQL')) { $record = DataObject::get_one($className, "\"{$className}\".ID = {$id}"); } else { $record = DataObject::get_one($className, "`{$className}`.ID = {$id}"); } // Is the template attached to the type, or the newsletter itself? $type = $record->getNewsletterType(); $form->saveInto($record); $record->write(); $id = 'draft_' . $record->ParentID . '_' . $record->ID; FormResponse::set_node_title($id, $record->Title); FormResponse::status_message('Saved', 'good'); // Get the new action buttons $actionList = ''; foreach ($form->Actions() as $action) { $actionList .= $action->Field() . ' '; } FormResponse::add("\$('Form_EditForm').loadActionsFromString('" . Convert::raw2js($actionList) . "');"); return FormResponse::respond(); }