本文整理汇总了PHP中Zend_Form_Element_Text::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::setOptions方法的具体用法?PHP Zend_Form_Element_Text::setOptions怎么用?PHP Zend_Form_Element_Text::setOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::setOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
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:')->setOptions(array('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:')->setOptions(array('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:')->setOptions(array('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);
}
示例2: init
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);
}
示例3: init
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'));
}
示例4: init
/**
* 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();
}
示例5: init
/**
* 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);
}
示例6: init
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'));
}
示例7: getAllAsForm
/**
* 一覧をフォーム形式で取得
*/
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;
}
示例8: init
/**
* 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);
}
示例9: init
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'));
}
示例10: init
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'));
}
示例11: init
/**
* 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);
}
示例12: init
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'));
}
示例13: init
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'));
}
示例14: getLoginForm
/**
* Create and return the login form
*
* @return object
*/
protected function getLoginForm()
{
$username = new Zend_Form_Element_Text('username');
$username->setLabel('Username:')->setRequired(true)->setDecorators(array(array('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:')->setRequired(true)->setDecorators(array(array('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;
}
示例15: init
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'));
}