_bindFormFields( $this->_getBaseForm() ); $backUrl = parent::getBackUrl(); if (false === strpos($backUrl, '?')){ $sep = '?'; }else { $sep = '&'; } $backUrl .= $sep .'name='.urldecode($form->getElementValue('name')); return $backUrl; } function _getEditForm() { $form = parent::_getEditForm(); if ($form->elementExists('name')){ $form->insertElementBefore(Form::createElement('static', 'name_static', 'Name', $this->DBObj->getData('name') ) ,'name'); $form->removeElement('name'); } return $form; } function _bindFormFields($form) { $form = parent::_bindFormFields($form); $form->addRule('name', 'Name is required', 'required', null, 'client'); $form->addRule('name', 'Name is required', 'required'); $form->addRule('name', 'Invalid Name', 'item_name', null, 'client'); $form->addRule('name', 'Invalid Name', 'item_name'); $form->addFormRule(array(&$this, 'validName') ); return $form; } function validName($fields) { if ($this->DBObj->isNameUnique($fields['name'])){ return true; }else { return array('name' => 'The name must be unique'); } } function doList() { require_once 'class/Session.php'; Session::clearData('admin_sect', 'tplLite' ); parent::doList(); } } ?>