/** * Add a whitelist record */ public function actionAdd() { // Build Form Definition $definition = array(); $definition['elements'] = array(); // Define Form Eleements $definition['elements']['EmailWhitelist'] = array('type' => 'form', 'elements' => array('domain' => array('type' => 'text', 'class' => 'form-control', 'maxlength' => 25))); // Get Form Definition $definition['buttons'] = array('save' => array('type' => 'submit', 'class' => 'btn btn-primary', 'label' => 'Create')); $form = new HForm($definition); $form['EmailWhitelist']->model = EmailWhitelist::model(); // Save new karma if ($form->submitted('save') && $form->validate()) { $emailWhitelistModel = new EmailWhitelist(); $emailWhitelistModel->domain = $form['EmailWhitelist']->model->domain; $emailWhitelistModel->save(); $this->redirect($this->createUrl('index')); } $this->render('add', array('form' => $form)); }