public function init() { // initialize form $this->setAction('/signup')->setMethod('post'); $firstname = new Zend_Form_Element_Text('FirstName'); $firstname->setLabel('First name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); $lastname = new Zend_Form_Element_Text('LastName'); $lastname->setLabel('Last name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); // create text input for email address $email = new Zend_Form_Element_Text('Email'); $email->setLabel('Email address:'); $email->setOptions(array('size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress', true)->addFilter('HtmlEntities')->addFilter('StringToLower')->addFilter('StringTrim'); // create text input for name $UserName = new Zend_Form_Element_Text('UserName'); $UserName->setLabel('Username:'******'size' => '50'))->setRequired(true)->addValidator('Alnum')->addFilter('HtmlEntities')->addFilter('StringTrim'); // create text input for password $Password = new Zend_Form_Element_Password('Password'); $Password->setLabel('Password:'******'size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); // create text input for password confirmation $ConfirmPassword = new Zend_Form_Element_Password('ConfirmPassword'); $ConfirmPassword->setLabel('Confirm Password:'******'size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); // create submit button $submit = new Zend_Form_Element_Submit('register'); $submit->setLabel('Register')->setOptions(array('class' => 'submit')); // attach elements to form $this->addElement($firstname)->addElement($lastname)->addElement($email)->addElement($UserName)->addElement($Password)->addElement($ConfirmPassword)->addElement($submit); }
public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $checkEmailNotJunk = new Zend_Validate_Callback(array($this, 'emailNotJetable')); $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email')); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => $this->t('Email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $checkEmailNotJunk, $uniqueEmailValidator))); $this->addElement($email); $raisonsocial = new Zend_Form_Element_Text('raison sociale'); $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($raisonsocial); // $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3))); // $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100)); $this->addElement($submit); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $requestid = new Zend_Form_Element_Hidden('RequestID'); $requestid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $maTS = new Zend_Form_Element_Text('MaTS'); $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); // // $UserID = new Zend_Form_Element_Text('UserID'); // $UserID->setOptions(array( // 'label' => 'UserID', // 'required' => TRUE, // 'filters' => array('StringTrim') // )) // ->setDecorators(array( // array('ViewHelper', array('helper' => 'formText')), // array('Label', array('class' => 'label')) // )); $utype = new Zend_Form_Element_Select('Type'); $utype->setOptions(array('label' => 'Loại yêu cầu', 'required' => TRUE, 'MultiOptions' => array(0 => 'Yêu cầu mượn TS', 1 => 'Yêu cầu nâng cấp')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $detail = new Zend_Form_Element_Textarea('Detail'); $detail->setOptions(array('label' => 'Chi tiết yêu cầu', 'style' => "width: 200px; height: 100px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($requestid, $maTS, $utype, $detail))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $username = new Zend_Form_Element_Text('username'); // $this->t = Zend_Registry::get('Zend_Translate'); $username->setOptions(array('label' => $this->t('Username'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($username); $password = new Zend_Form_Element_Password('password'); $password->setOptions(array('label' => $this->t('Password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($password); $authentification = new LoginAttempt(); if ($authentification->canAttemptToLogin() == FALSE) { $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->t("no humain"), 'captcha' => array("captcha" => "Image", "wordLen" => 4, "font" => "font/tahoma.ttf", "height" => 100, "width" => 300, "fontSize" => 50, "imgDir" => "data/captchas", "imgUrl" => "data/captchas"))); $this->addElement($captcha); } $connexion = new Zend_Form_Element_Submit('Connexion'); $connexion->setOptions(array('label' => $this->t('Log In'))); $connexion->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'openOnly' => true)))); $this->addElement($connexion); $inscription = new Zend_Form_Element_Submit('inscription'); $inscription->setOptions(array('label' => $this->t('Sign Up'))); $inscription->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($inscription); $this->clearDecorators(); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); //source //alias aliasNotLogged viewIdentifier viewTitle params isStatic //metaKeywords metaDescription $id = new Zend_Form_Element_Hidden('urlAliasId'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $source = new Zend_Form_Element_Text('source'); $source->setOptions(array('label' => 'Source', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($source); $alias = new Zend_Form_Element_Text('alias'); $alias->setOptions(array('label' => 'Alias', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($alias); $params = new Zend_Form_Element_Text('params'); $params->setOptions(array('value' => '{"module":"frontend","controller":"__","action":"__"}', 'label' => 'Params', 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($params); $isStatic = new Zend_Form_Element_Text('isStatic'); $isStatic->setOptions(array('label' => 'isStatic', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($isStatic); $metaKeywords = new Zend_Form_Element_Text('metaKeywords'); $metaKeywords->setOptions(array('label' => 'metaKeywords', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($metaKeywords); $metaDescription = new Zend_Form_Element_Text('metaDescription'); $metaDescription->setOptions(array('label' => 'metaDescription', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($metaDescription); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $userid = new Zend_Form_Element_Hidden('UserID'); $username = new Zend_Form_Element_Text('Username'); $username->setOptions(array('label' => 'Username', 'required' => TRUE, 'filters' => array('StringTrim'))); $password = new Zend_Form_Element_Password('Password'); $password->setOptions(array('label' => 'Password', 'required' => TRUE)); $repassword = new Zend_Form_Element_Password('RePassword'); $repassword->setOptions(array('label' => 'Retype Password', 'required' => TRUE)); $role = new Zend_Form_Element_Hidden('Role'); $fullname = new Zend_Form_Element_Text('FullName'); $fullname->setOptions(array('label' => 'FullName')); $email = new Zend_Form_Element_Text('Email'); $email->setOptions(array('label' => 'Email', 'required' => TRUE)); $birthday = new Zend_Form_Element_Text("Birthday"); $birthday->setOptions(array('label' => 'Birthday')); $group = new Zend_Form_Element_Text('Group'); $group->setOptions(array('label' => 'Group')); $phone = new Zend_Form_Element_Text('Phone'); $phone->setOptions(array('label' => 'Phone')); $address = new Zend_Form_Element_Text('Address'); $address->setOptions(array('label' => 'Address')); $submit = new Zend_Form_Element_Submit('Submit'); $this->setName('profile-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $password, $repassword, $role, $fullname, $email, $birthday, $group, $phone, $address, $submit))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form')); }
/** * 一覧をフォーム形式で取得 */ public function getAllAsForm($delivery_id, $form, $order_id = 0) { $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $models = $db->fetchAll("SELECT * FROM `dtb_delivery_detail` WHERE `delivery_id` = ? ORDER BY size", $delivery_id); if (!$models) { $size_order = $db->fetchAll("SELECT * FROM `dtb_order_detail` WHERE `order_id` = ? ORDER BY size ASC", $order_id); $models = array(); $total = 0; foreach ($size_order as $pair) { $size_delivery = $db->fetchOne("SELECT SUM(`detail`.`quantity`) as quantity \n FROM dtb_delivery delivery, dtb_delivery_detail detail \n WHERE delivery.id = detail.delivery_id AND order_id = ? AND `size` = ? \n GROUP BY size ORDER BY size ASC", array($order_id, $pair['size'])); $pair['quantity'] -= $size_delivery; $total += $pair['quantity']; array_push($models, $pair); } $form->setDefault('quantity', $total); $form->setDefault('quantity_ori', $total); } foreach ($models as $model) { $id = $model['id']; $elem = new Zend_Form_Element_Text("quantity_{$id}"); $elem->setOptions(array('size' => '3', 'onkeyup' => 'sum()', 'style' => 'text-align:right')); $elem->setValue($model['quantity']); $form->addElement($elem); } return $form; }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $start_date = new Zend_Form_Element_Text('start_date'); $start_date->setOptions(array('label' => $this->t('Start date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($start_date); $end_date = new Zend_Form_Element_Text('end_date'); $end_date->setOptions(array('label' => $this->t('End Date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($end_date); $is_posted = new Zend_Form_Element_Checkbox('is_posted'); $this->addElement($is_posted); $companyName = new Zend_Form_Element_Text('name'); $companyName->setOptions(array('label' => $this->t('Company'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($companyName); $function = new Zend_Form_Element_Text('function'); $function->setOptions(array('label' => $this->t('function'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($function); $mission = new Zend_Form_Element_Textarea('mission'); $mission->setOptions(array('label' => $this->t('mission'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($mission); $city_name = new Zend_Form_Element_Text('city_name'); $city_name->setOptions(array('label' => $this->t('city'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($city_name); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $itemid = new Zend_Form_Element_Hidden('ItemID'); $itemid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $maTS = new Zend_Form_Element_Text('MaTS'); $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $tenTS = new Zend_Form_Element_Text('TenTS'); $tenTS->setOptions(array('label' => 'Tên tài sản', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $descr = new Zend_Form_Element_Textarea('Description'); $descr->setOptions(array('label' => 'Mô tả', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $type = new Zend_Form_Element_Select('Type'); $type->setOptions(array('label' => 'Loại bảo mật', 'required' => TRUE, 'MultiOptions' => array(1 => 'Bảo mật thấp', 0 => 'Bảo mật cao')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $startDate = new Zend_Form_Element_Text('StartDate'); $startDate->setOptions(array('label' => 'Bắt đầu SD', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $price = new Zend_Form_Element_Text('Price'); $price->setOptions(array('label' => 'Giá', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $warrantyTime = new Zend_Form_Element_Text('WarrantyTime'); $warrantyTime->setOptions(array('label' => 'Bảo hành', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $status = new Zend_Form_Element_Select('Status'); $status->setOptions(array('label' => 'Tình trạng', 'required' => TRUE, 'MultiOptions' => array(0 => 'Có thể mượn', 1 => 'Đang cho mượn', 2 => 'Hỏng')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $place = new Zend_Form_Element_Textarea('Place'); $place->setOptions(array('label' => 'Địa điểm hiện tại', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($itemid, $maTS, $tenTS, $descr, $type, $startDate, $price, $warrantyTime, $status, $place))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $userid = new Zend_Form_Element_Hidden('UserID'); $userid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $username = new Zend_Form_Element_Text('Username'); $username->setOptions(array('label' => 'Username', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $birthday = new Zend_Form_Element_Text('Birthday'); $birthday->setOptions(array('label' => 'Birthday', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $role = new Zend_Form_Element_Select('Role'); $role->setOptions(array('label' => 'User Type', 'MultiOptions' => array(3 => 'User', 2 => 'IT', 1 => 'Admin', 0 => 'SuperAdmin')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $fullname = new Zend_Form_Element_Text('FullName'); $fullname->setOptions(array('label' => 'FullName'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $email = new Zend_Form_Element_Text('Email'); $email->setOptions(array('label' => 'Email', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $group = new Zend_Form_Element_Text('Group'); $group->setOptions(array('label' => 'Group'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $phone = new Zend_Form_Element_Text('Phone'); $phone->setOptions(array('label' => 'Phone'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $address = new Zend_Form_Element_Textarea('Address'); $address->setOptions(array('label' => 'Address', 'style' => "width: 200px; height: 150px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('user-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $role, $fullname, $email, $birthday, $group, $phone, $address))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'readonly' => 'readonly')); $this->addElement($username); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => 'Email address', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', 'EmailAddress'))); $this->addElement($email); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => 'Phone number', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save profile', 'required' => true)); $this->addElement($submit); }
public function init() { $name = new Zend_Form_Element_Text('Name'); $name->setOptions(array('label' => 'Name', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $email = new Zend_Form_Element_Text('Email'); $email->setOptions(array('label' => 'Email', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $subject = new Zend_Form_Element_Select('Subject'); $subject->setOptions(array('label' => 'Subject', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $content = new Zend_Form_Element_Textarea('Content'); $content->setOptions(array('label' => 'Content', 'style' => "width: 300px; height: 200px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($name, $email, $subject, $content))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => TRUE, 'filters' => array('StringTrim'))); $password = new Zend_Form_Element_Password('password'); $password->setOptions(array('label' => 'Password', 'required' => TRUE)); $login = new Zend_Form_Element_Submit('login'); $login->setOptions(array('label' => 'Login')); $this->setName('login-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($username, $password, $login))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form')); }
/** * Create and return the login form * * @return object */ protected function getLoginForm() { $username = new Zend_Form_Element_Text('username'); $username->setLabel('Username:'******'ViewScript', array('viewScript' => '_form/text.phtml', 'placement' => false)))); $username->setOptions(array('placeholder' => 'username...', 'inputtype' => 'text')); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password:'******'ViewScript', array('viewScript' => '_form/text.phtml', 'placement' => false)))); $password->setOptions(array('placeholder' => 'password...', 'inputtype' => 'password')); $submit = new Zend_Form_Element_Submit('login'); $submit->setLabel('Login'); $loginForm = new Zend_Form(); $loginForm->setAction($this->_request->getBaseUrl() . '/login/index/')->setMethod('post')->addElement($username)->addElement($password)->addElement($submit); return $loginForm; }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'feedforwardinit'); $id = new Zend_Form_Element_Hidden('id'); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode'); $appraisal_mode->setLabel("Appraisal"); $appraisal_mode->setMultiOptions(array('' => 'Select Appraisal')); $appraisal_mode->setAttrib('class', 'selectoption'); $appraisal_mode->setRequired(true); $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.')); $status = new Zend_Form_Element_Select('status'); $status->setLabel("Status"); $status->setAttrib('class', 'selectoption'); $status->setMultiOptions(array('1' => 'Open')); //,'2' => 'Close' $status->setRegisterInArrayValidator(false); $status->setRequired(true); $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $employee_name_view = new Zend_Form_Element_Radio('employee_name_view'); $employee_name_view->setLabel("Employee Details"); $employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide')); $employee_name_view->setSeparator(''); $employee_name_view->setValue(0); $employee_name_view->setRegisterInArrayValidator(false); $enable_to = new Zend_Form_Element_MultiCheckbox('enable_to'); $enable_to->setLabel("Enable To"); $enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees')); $enable_to->setSeparator(''); $enable_to->setValue(0); $enable_to->setRequired(true); $enable_to->setRegisterInArrayValidator(false); $enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.')); $ff_due_date = new Zend_Form_Element_Text('ff_due_date'); $ff_due_date->setLabel("Due Date"); $ff_due_date->setOptions(array('class' => 'brdr_none')); $ff_due_date->setRequired(true); $ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $save = new Zend_Form_Element_Submit('submit'); $save->setAttrib('id', 'submitbutton'); $save->setLabel('Save & Initialize'); $save_later = new Zend_Form_Element_Submit('submit'); $save_later->setAttrib('id', 'submitbutton1'); $save_later->setLabel('Save & Initialize Later'); $this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $maTS = new Zend_Form_Element_Text('MaTS'); $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $Username = new Zend_Form_Element_Text('Username'); $Username->setOptions(array('label' => 'Người mượn', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $detail = new Zend_Form_Element_Textarea('Detail'); $detail->setOptions(array('label' => 'Chi tiết', 'style' => "width: 200px; height: 100px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $place = new Zend_Form_Element_Textarea('Place'); $place->setOptions(array('label' => 'Địa điểm', 'style' => "width: 200px; height: 100px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($maTS, $Username, $detail, $place))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); // $username = new Zend_Form_Element_Text('username'); // $username->setOptions( // array( // 'label' => $this->t('Username'), // 'required' => true, // 'filters' => array( // 'StringTrim', // 'StripTags', // ), // 'validators' => array( // 'NotEmpty', // ), // 'readonly' => 'readonly', // ) // ); // $this->addElement($username); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $firstname = new Zend_Form_Element_Text('first_name'); $firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('last_name'); $lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => $this->t('Email address'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', 'EmailAddress'))); $this->addElement($email); $birthdate = new Zend_Form_Element_Text('birthdate'); $birthdate->setOptions(array('label' => $this->t('birthdate'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($birthdate); $city = new Zend_Form_Element_Text('name'); $city->setOptions(array('label' => $this->t('city'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($city); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => $this->t('Phone number'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save profile'), 'required' => true)); $this->addElement($submit); }
/** * 一覧をフォーム形式で取得 */ public function getAllAsForm($order_id, $form) { $db = Zend_Db_Table_Abstract::getDefaultAdapter(); $models = $db->fetchAll("SELECT * FROM `dtb_order_detail` WHERE `order_id` = ? ORDER BY size", $order_id); if (!$models) { return; } foreach ($models as $model) { $id = $model['id']; $elem = new Zend_Form_Element_Text("quantity_{$id}"); $elem->setOptions(array('size' => '3', 'onkeyup' => 'sum()')); $elem->setValue($model['quantity']); $form->addElement($elem); } return $form; }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($username); $password = new Zend_Form_Element_Password('password'); $password->setOptions(array('label' => 'Password', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($password); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Log in →', 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method // set the form's method $this->setAction('/contact/listmycontact')->setMethod('post'); $firstName = new Zend_Form_Element_Text('search'); $firstName->setOptions(array('value' => $this->t('Search'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstName); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Type'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Reseau' => 'Réseau', 'Mycontact' => 'Mes Contacts'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit_search'); $submit->setOptions(array('label' => $this->t('Search'), 'required' => true)); $this->addElement($submit); }
protected function elementText($title, $options = null, $conf = null) { $element = new Zend_Form_Element_Text($title); if (is_array($options)) { $element->setOptions($options); } elseif (!is_null($options)) { $element->setLabel($options); } $element->addFilter('StringTrim'); if (!empty($conf['filters'])) { $element->addFilters($conf['filters']); } if (!empty($conf['validators'])) { $element->addValidators($conf['validators']); } return $element; }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $skills = new Zend_Form_Element_Text('name'); $skills->setOptions(array('label' => $this->t('Skills'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($skills); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $raisonsocial = new Zend_Form_Element_Text('raison sociale'); $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($raisonsocial); // $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3))); // $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100)); $this->addElement($submit); }
public function init() { // initialize form $this->setAction('/user/account/update')->setMethod('post'); $firstname = new Zend_Form_Element_Text('FirstName'); $firstname->setLabel('First name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); $lastname = new Zend_Form_Element_Text('LastName'); $lastname->setLabel('Last name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim'); // create text input for email address $email = new Zend_Form_Element_Text('Email'); $email->setLabel('Email address:'); $email->setOptions(array('size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress', true)->addFilter('HtmlEntities')->addFilter('StringToLower')->addFilter('StringTrim'); // create submit button $submit = new Zend_Form_Element_Submit('update'); $submit->setLabel('Update')->setOptions(array('class' => 'submit')); // attach elements to form $this->addElement($firstname)->addElement($lastname)->addElement($email)->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $nameCompany = new Zend_Form_Element_Text('name'); $nameCompany->setOptions(array('label' => $this->t('Raison social'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($nameCompany); $synopsis = new Zend_Form_Element_Textarea('synopsis'); $synopsis->setOptions(array('label' => $this->t('synopsis'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($synopsis); $file = new Zend_Form_Element_File('logo'); $file->setLabel('image')->setAttrib('enctype', 'multipart/form-data')->setDestination(APPLICATION_PATH . '/../public/frontend/images/logo/')->setRequired(false); $this->addElement($file); $rc = new Zend_Form_Element_Text('rc'); $rc->setOptions(array('label' => $this->t('rc'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($rc); $patente = new Zend_Form_Element_Text('patente'); $patente->setOptions(array('label' => $this->t('patente'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($patente); $createDate = new Zend_Form_Element_Text('create_date'); $createDate->setOptions(array('label' => $this->t('create_date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($createDate); $tel = new Zend_Form_Element_Text('tel'); $tel->setOptions(array('label' => $this->t('tel'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($tel); $fax = new Zend_Form_Element_Text('fax'); $fax->setOptions(array('label' => $this->t('fax'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($fax); $adress = new Zend_Form_Element_Text('adress'); $adress->setOptions(array('label' => $this->t('adress'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($adress); $description = new Zend_Form_Element_Text('description'); $description->setOptions(array('label' => $this->t('description'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($description); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $groupModel = new Group(); $groupsOptions = $groupModel->findPairs(); $uniqueUsernameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'username')); $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email')); $groupsInArrayValidator = new Zend_Validate_InArray(array_keys($groupsOptions)); $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueUsernameValidator))); $this->addElement($username); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => 'Email', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueEmailValidator))); $this->addElement($email); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => 'Phone number', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $groups = new Zend_Form_Element_MultiCheckbox('groups'); $groups->setOptions(array('label' => 'Select the one or more user groups for this user', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $groupsInArrayValidator), 'multiOptions' => $groupsOptions)); $this->addElement($groups); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save user', 'required' => true, 'order' => 100)); $this->addElement($submit); $this->addDisplayGroup(array('username', 'email', 'firstname', 'lastname', 'phone_number'), 'userdata')->getDisplayGroup('userdata')->setLegend('User details'); $this->addDisplayGroup(array('groups'), 'usergroups')->getDisplayGroup('usergroups')->setLegend('Groups'); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $firstName = new Zend_Form_Element_Text('fistName_son'); $firstName->setOptions(array('value' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstName); $lastName = new Zend_Form_Element_Text('lastName_son'); $lastName->setOptions(array('value' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastName); $email = new Zend_Form_Element_Text('email_son'); $email->setOptions(array('value' => $this->t('email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($email); $submit = new Zend_Form_Element_Submit('submit_sponsor'); $submit->setOptions(array('label' => $this->t('Envoyer mon invitation'), 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $uniqueGroupNameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'groups', 'field' => 'name')); $groupModel = new Group(); $parentIdOptions = $groupModel->findPairs(); $name = new Zend_Form_Element_Text('name'); $name->setOptions(array('label' => 'Name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueGroupNameValidator))); $this->addElement($name); $parentId = new Zend_Form_Element_Select('parent_id'); $parentId->setOptions(array('label' => 'Parent group', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $parentIdOptions)); $this->addElement($parentId); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save user group', 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $start_date = new Zend_Form_Element_Text('start_date'); $start_date->setOptions(array('label' => $this->t('Start date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($start_date); $end_date = new Zend_Form_Element_Text('end_date'); $end_date->setOptions(array('label' => $this->t('End Date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($end_date); $schoolName = new Zend_Form_Element_Text('school'); $schoolName->setOptions(array('label' => $this->t('School Name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($schoolName); $domain = new Zend_Form_Element_Text('domain'); $domain->setOptions(array('label' => $this->t('domain'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($domain); $degree = new Zend_Form_Element_Text('degree'); $degree->setOptions(array('label' => $this->t('Degree'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($degree); $result = new Zend_Form_Element_Text('result'); $result->setOptions(array('label' => $this->t('Result'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($result); $activity = new Zend_Form_Element_Text('activity'); $activity->setOptions(array('label' => $this->t('Activity'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($activity); $information_add = new Zend_Form_Element_Text('information_add'); $information_add->setOptions(array('label' => $this->t('Additional Information'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($information_add); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $flagModel = new Flag(); $flagIdOptions = $flagModel->findPairs(); $name = new Zend_Form_Element_Text('name'); $name->setOptions(array('label' => 'Name', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($name); $flagId = new Zend_Form_Element_Select('flag_id'); $flagId->setOptions(array('label' => 'Flag', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $flagIdOptions)); $this->addElement($flagId); $description = new Zend_Form_Element_Text('description'); $description->setOptions(array('label' => 'Description', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($description); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save privilege', 'required' => TRUE)); $this->addElement($submit); }