diff --git a/application/controllers/DatalistentryController.php b/application/controllers/DatalistentryController.php index 1581d78c..5916dccc 100644 --- a/application/controllers/DatalistentryController.php +++ b/application/controllers/DatalistentryController.php @@ -40,6 +40,7 @@ class Director_DatalistentryController extends ActionController } $form = $this->view->form = $this->loadForm('directorDatalistentry') + ->setListId($listId) ->setSuccessUrl('director/datalistentry' . '?list_id=' . $listId) ->setDb($this->db()); diff --git a/application/forms/DirectorDatalistentryForm.php b/application/forms/DirectorDatalistentryForm.php index 63ee5506..2e411a4a 100644 --- a/application/forms/DirectorDatalistentryForm.php +++ b/application/forms/DirectorDatalistentryForm.php @@ -6,6 +6,8 @@ use Icinga\Module\Director\Web\Form\DirectorObjectForm; class DirectorDatalistEntryForm extends DirectorObjectForm { + protected $listId; + public function setup() { $this->addElement('text', 'entry_name', array( @@ -18,9 +20,17 @@ class DirectorDatalistEntryForm extends DirectorObjectForm 'label' => 'Type', 'multiOptions' => array('string' => $this->translate('String')) )); + } - $this->addElement('hidden', 'list_id', array( - 'value' => $this->getRequest()->getParam('list_id'), - )); + public function onSuccess() + { + $this->object()->list_id = $this->listId; + parent::onSuccess(); + } + + public function setListId($id) + { + $this->listId = $id; + return $this; } }