本文整理汇总了PHP中Zend_Form_Element_Radio::setAttrib方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Radio::setAttrib方法的具体用法?PHP Zend_Form_Element_Radio::setAttrib怎么用?PHP Zend_Form_Element_Radio::setAttrib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Radio
的用法示例。
在下文中一共展示了Zend_Form_Element_Radio::setAttrib方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildCat2Element
protected function buildCat2Element()
{
$cat2 = new Zend_Form_Element_Radio('cat2');
$cat2->setLabel($this->_business->getCat2Name());
$cat2->addMultiOptions($this->_business->getCat2Array(null, false));
$cat2->setValue($this->_business->getFirstCat2(null, false));
$cat2->setAttrib('class', 'refineformselect');
$cat2->setAttrib('onclick', "changeCat2(this.id,this.value, '/ajax/realestate/changecat2/')");
$this->addElement($cat2);
}
示例2: buildCat1Element
protected function buildCat1Element()
{
$cat1 = new Zend_Form_Element_Radio('cat1');
$cat1->setLabel($this->_business->getCat1Name());
$cat1->setMultiOptions($this->_business->getCat1Array());
//$cat1->setValue($this->_business->getFirstCat1());
logfire('FFFkey', $this->_business->getFirstCat1());
$cat1->setValue($this->_business->getFirstCat1());
$cat1->setAttrib('class', 'refineformselect');
$this->addElement($cat1);
}
示例3: __construct
public function __construct($options = null)
{
// $this->_disabledDefaultActions = true;
// $this->_object = $options['object'];
unset($options['object']);
parent::__construct($options);
// Subform for the retailer status on website
$retailerForm = new Cible_Form_SubForm();
$retailerForm->setName('retailerForm')->removeDecorator('DtDdWrapper');
//checkbox to set the retailers address as valid
$isValid = new Zend_Form_Element_Checkbox('R_Active');
$isValid->setLabel($this->getView()->getCibleText('form_label_approved_onweb'));
$isValid->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
$retailerForm->addElement($isValid);
$isRetailer = new Zend_Form_Element_Radio('isDistributeur');
$isRetailer->setLabel($this->getView()->getCibleText('form_label_Display_web'))->setOrder(0);
$isRetailer->setSeparator('');
$isRetailer->setAttrib('class', 'vertAlignRadio');
$isRetailer->addMultiOptions(array(1 => $this->getView()->getCibleText('form_account_no'), 2 => $this->getView()->getCibleText('form_account_yes')))->setValue(1);
$txtFr = new Cible_Form_Element_Html('lblFr', array('value' => $this->getView()->getCibleText('form_address_retailer_fr')));
$txtFr->setOrder(1)->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage'))));
$retailerForm->addElement($txtFr);
$adressRetailer = new Cible_View_Helper_FormAddress($retailerForm);
$adressRetailer->enableFields(array('name' => true, 'firstAddress' => false, 'secondAddress' => false, 'state' => false, 'cityTxt' => false, 'zipCode' => false, 'country' => false, 'firstTel' => false, 'secondTel' => false, 'fax' => false, 'email' => false, 'webSite' => false));
$adressRetailer->formAddress();
$retailerForm->addElement($isRetailer);
$retailerForm->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree');
// Subform for the retailer status on website
$retailerFormEn = new Cible_Form_SubForm();
$retailerFormEn->setName('retailerFormEn')->removeDecorator('DtDdWrapper');
$txtEn = new Cible_Form_Element_Html('lblEn', array('value' => $this->getView()->getCibleText('form_address_retailer_en')));
$txtEn->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'formLanguage'))));
$adressRetailerEn = new Cible_View_Helper_FormAddress($retailerFormEn);
$adressRetailerEn->enableFields(array('name' => false, 'firstAddress' => false, 'secondAddress' => false, 'firstTel' => false, 'secondTel' => false, 'webSite' => false));
$adressRetailerEn->formAddress();
$retailerFormEn->addElement($txtEn);
$retailerFormEn->getElement('AI_SecondTel')->setAttrib('class', 'stdTextInput phoneFree');
//*** Add subform to the form ***/
$this->addSubForm($retailerForm, 'retailerForm');
$this->addSubForm($retailerFormEn, 'retailerFormEn');
}
示例4: getForm
public function getForm()
{
$elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
$form = new Zend_Form();
$form->setAction('/student/profile/feedback/')->setMethod('post');
$improvement = new Zend_Form_Element_Radio('improvement', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'Yes', 'No' => 'No')));
$improvement->setDecorators($elementDecorators);
$level = new Zend_Form_Element_Radio('level', array('label' => '', 'separator' => '', 'multiOptions' => array('Hard' => 'Hard', 'Suitable' => 'Suitable', 'Easy' => 'Easy')));
$level->setAttrib('class', 'radio_new');
$level->setDecorators($elementDecorators);
$difficult = new Zend_Form_Element_Text('difficult', array('id' => 'difficult', 'maxLength' => '50'));
$difficult->setDecorators($elementDecorators);
$difficult->setAttrib('class', 'sub_text_input');
$suggestions = new Zend_Form_Element_Textarea('suggestions', array('label' => '?האם חווית בעיה בתרגול', 'id' => 'suggestions'));
$suggestions->setAttrib('class', 'sub_textarea');
$sendFeedback = new Zend_Form_Element_Button('sendfeedback', array('id' => 'sendfeedback', 'label' => 'ds'));
$sendFeedback->setAttrib('class', 'sub_button_input');
$sendFeedback->setDecorators($elementDecorators);
$form->addElements(array($improvement, $level, $difficult, $suggestions));
return $form;
}
示例5: init
public function init()
{
$this->setMethod('post');
//$this->setAttrib('action',DOMAIN.'language/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'servicedeskrequests');
$id = new Zend_Form_Element_Hidden('id');
$postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
$businessunit_id = new Zend_Form_Element_Select('businessunit_id');
$businessunit_id->setLabel("Business Unit");
$businessunit_id->setAttrib('class', 'selectoption');
if ($postid == '') {
$businessunit_id->setAttrib('onchange', 'displayemployees(this)');
$bunitModel = new Default_Model_Businessunits();
$bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname');
$businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit'));
foreach ($bunitdata->toArray() as $data) {
$businessunit_id->addMultiOption($data['id'], $data['unitname']);
}
} else {
$businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
}
$businessunit_id->setRegisterInArrayValidator(false);
$businessunit_id->setRequired(true);
$businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
$department_id = new Zend_Form_Element_Select('department_id');
$department_id->setLabel("Department");
$department_id->setAttrib('class', 'selectoption');
$department_id->addMultiOption('', 'Select Department');
if ($postid == '') {
$department_id->setAttrib('onchange', 'displayemployees(this)');
}
$department_id->setRegisterInArrayValidator(false);
$service_desk_flag = new Zend_Form_Element_Radio('service_desk_flag');
$service_desk_flag->setLabel("Applicability");
$service_desk_flag->setAttrib('onclick', 'changeimplementation(this)');
$service_desk_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise'));
$service_desk_flag->setSeparator('');
$service_desk_flag->setValue(1);
$service_desk_flag->setRegisterInArrayValidator(false);
$service_desk_flag->setRequired(true);
$service_desk_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.'));
$service_desk_id = new Zend_Form_Element_Select('service_desk_id');
$service_desk_id->setLabel("Category");
$service_desk_id->setAttrib('class', 'selectoption');
$service_desk_id->addMultiOption('', 'Select category');
$service_desk_id->setRegisterInArrayValidator(false);
$service_desk_id->setRequired(true);
$service_desk_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.'));
$request_recievers = new Zend_Form_Element_Multiselect('request_recievers');
$request_recievers->setLabel("Executors");
$request_recievers->setAttrib('class', 'selectoption');
$request_recievers->setRegisterInArrayValidator(false);
$request_recievers->setRequired(true);
$request_recievers->addValidator('NotEmpty', false, array('messages' => 'Please select executor.'));
$approvingauthority = new Zend_Form_Element_Select('approvingauthority');
$approvingauthority->setLabel("No. of Approvers");
$approvingauthority->setAttrib('class', 'selectoption');
$approvingauthority->setAttrib('onchange', 'displayapprovingauthority(this)');
$approvingauthority->addMultiOptions(array('' => 'Select no. of approvers', '1' => '1', '2' => '2', '3' => '3'));
$approvingauthority->setRegisterInArrayValidator(false);
$approvingauthority->setRequired(true);
$approvingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select no. of approvers.'));
$approver_1 = new Zend_Form_Element_Select('approver_1');
$approver_1->setLabel("Approver 1");
$approver_1->setAttrib('class', 'selectoption');
$approver_1->addMultiOption('', 'Select Approver 1');
$approver_1->setAttrib('onchange', 'displayapprovingauthority(this)');
$approver_1->setRegisterInArrayValidator(false);
$approver_2 = new Zend_Form_Element_Select('approver_2');
$approver_2->setLabel("Approver 2");
$approver_2->setAttrib('class', 'selectoption');
$approver_2->addMultiOption('', 'Select Approver 2');
$approver_2->setAttrib('onchange', 'displayapprovingauthority(this)');
$approver_2->setRegisterInArrayValidator(false);
$approver_3 = new Zend_Form_Element_Select('approver_3');
$approver_3->setLabel("Approver 3");
$approver_3->setAttrib('class', 'selectoption');
$approver_3->addMultiOption('', 'Select Approver 3');
$approver_3->setRegisterInArrayValidator(false);
$cc_mail_recievers = new Zend_Form_Element_Multiselect('cc_mail_recievers');
$cc_mail_recievers->setLabel("Request Viewers");
$cc_mail_recievers->setAttrib('class', 'selectoption');
$cc_mail_recievers->setRegisterInArrayValidator(false);
$attachment = new Zend_Form_Element_Radio('attachment');
$attachment->setLabel("Attachment");
$attachment->addMultiOptions(array('1' => 'Yes', '0' => 'No'));
$attachment->setSeparator('');
$attachment->setValue(0);
$attachment->setRegisterInArrayValidator(false);
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel("Description");
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '200');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $businessunit_id, $department_id, $description, $service_desk_flag, $service_desk_id, $request_recievers, $approvingauthority, $approver_1, $approver_2, $approver_3, $cc_mail_recievers, $attachment, $submit));
$this->setElementDecorators(array('ViewHelper'));
//.........这里部分代码省略.........
示例6: init
public function init()
{
// public function __construct($app,$value) {
// // Zend_Dojo::enableForm($this);
// // parent::__construct($app);
// // parent::__construct($value);
$membertitle = new Zend_Form_Element_Select('membertitle');
$membertitle->setAttrib('class', 'txt_put');
$membertitle->setAttrib('id', 'membertitle');
$membertitle->setAttrib('tabindex', '3');
$membertitle->setAttrib($value, 'true');
$memberfirstname = new Zend_Form_Element_Text('memberfirstname');
$memberfirstname->setAttrib('class', '');
$memberfirstname->setAttrib('size', '10');
$memberfirstname->setAttrib('id', 'memberfirstname');
$memberfirstname1 = new Zend_Form_Element_Text('memberfirstname1');
$memberfirstname1->setAttrib('class', '');
$memberfirstname1->setAttrib('id', 'memberfirstname1');
$memberfirstname1->setAttrib('size', '10');
//$memberfirstname1->setAttrib('style','background-color: #5CB3FF');
$memberaddressline1 = new Zend_Form_Element_Text('memberaddressline1');
$memberaddressline1->setAttrib('class', 'txt_put');
$memberaddressline1->setAttrib('id', 'memberaddressline1');
$memberaddressline1->setAttrib('tabindex', '13');
$memberaddressline1->setAttrib($value, 'true');
// echo $value;
$membermiddlename = new Zend_Form_Element_Text('membermiddlename');
$membermiddlename->setAttrib('class', 'txt_put');
$membermiddlename->setAttrib('id', 'membermiddlename');
$membermiddlename->setAttrib('tabindex', '5');
$membermiddlename->setAttrib($value, 'true');
$memberaddressline2 = new Zend_Form_Element_Text('memberaddressline2');
$memberaddressline2->setAttrib('class', 'txt_put');
$memberaddressline2->setAttrib('id', 'memberaddressline2');
$memberaddressline2->setAttrib('tabindex', '14');
$memberaddressline2->setAttrib($value, 'true');
$memberlastname = new Zend_Form_Element_Text('memberlastname');
$memberlastname->setAttrib('class', 'txt_put');
$memberlastname->setAttrib('id', 'closedate');
$memberlastname->setAttrib('tabindex', '6');
$memberlastname->setAttrib($value, 'true');
$MFI_member = new Zend_Form_Element_Select('MFI_member');
// $MFI_member->addMultiOption('','Select');
$MFI_member->setAttrib('class', 'txt_put');
$MFI_member->setAttrib('id', 'MFI_member');
$memberaddressline3 = new Zend_Form_Element_Text('memberaddressline3');
$memberaddressline3->setAttrib('class', 'txt_put');
$memberaddressline3->setAttrib('id', 'memberaddressline3');
$memberaddressline3->setAttrib('tabindex', '15');
$memberaddressline3->setAttrib($value, 'true');
$memberpersonalid = new Zend_Form_Element_Text('memberpersonalid ');
$memberpersonalid->setAttrib('class', 'txt_put');
$memberpersonalid->setAttrib('id', 'memberpersonalid');
$memberpersonalid->setAttrib('tabindex', '7');
$memberpersonalid->setAttrib($value, 'true');
$memberdateofbirth = new Zend_Form_Element_Text('memberdateofbirth ');
$memberdateofbirth->setAttrib('tabindex', '8');
$memberdateofbirth->setAttrib('class', 'txt_put');
$memberdateofbirth->setAttrib('size', '10');
$memberdateofbirth->setAttrib('id', 'memberdateofbirth');
$memberdateofbirth->setAttrib($value, 'true');
$memberdateofbirth->setRequired(true)->addValidator(new Zend_Validate_Date('YYYY-MM-DD'), true, array('messages' => array(Zend_Validate_Date::FALSEFORMAT => 'Enter the valid date')));
$membercity = new Zend_Form_Element_Text('membercity');
$membercity->setAttrib('class', 'txt_put');
$membercity->setAttrib('id', 'membercity');
$membercity->setAttrib('tabindex', '16');
$membercity->setAttrib($value, 'true');
$gender_id = new Zend_Form_Element_Select('gender_id');
$gender_id->addMultiOption('', 'Select');
$gender_id->setAttrib('class', 'txt_put');
$gender_id->setAttrib('id', 'gender_id');
$gender_id->setAttrib('tabindex', '9');
$gender_id->setAttrib($value, 'true');
$memberstate = new Zend_Form_Element_Text('memberstate');
$memberstate->setAttrib('class', 'txt_put');
$memberstate->setAttrib('id', 'memberstate');
$memberstate->setAttrib('tabindex', '17');
$memberstate->setAttrib($value, 'true');
$membercountry = new Zend_Form_Element_Text('membercountry');
$membercountry->setAttrib('class', 'txt_put');
$membercountry->setAttrib('id', 'membercountry');
$membercountry->setAttrib('tabindex', '18');
$membercountry->setAttrib($value, 'true');
$memberpincode = new Zend_Form_Element_Text('memberpincode');
$memberpincode->setAttrib('class', 'txt_put');
$memberpincode->setAttrib('id', 'memberpincode');
$memberpincode->setAttrib('tabindex', '19');
$memberpincode->setAttrib($value, 'true');
$memberphone = new Zend_Form_Element_Text('memberphone');
$memberphone->setAttrib('class', 'txt_put');
$memberphone->setAttrib('id', 'memberphone');
$memberphone->setAttrib('tabindex', '20');
$memberphone->setAttrib($value, 'true');
$memberchildrennumber = new Zend_Form_Element_Text('memberchildrennumber');
$memberchildrennumber->setAttrib('class', 'txt_put');
$memberchildrennumber->setAttrib('id', 'memberchildrennumber');
$memberprofession = new Zend_Form_Element_Text('memberprofession');
$memberprofession->setAttrib('class', 'txt_put');
$memberprofession->setAttrib('id', 'memberprofession');
$membereducation = new Zend_Form_Element_Text('membereducation');
//.........这里部分代码省略.........
示例7: init
public function init()
{
$this->setMethod('post');
//$this->setAttrib('action',DOMAIN.'language/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'appraisalconfig');
$id = new Zend_Form_Element_Hidden('id');
$postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
$businessunit_id = new Zend_Form_Element_Select('businessunit_id');
$businessunit_id->setLabel("Business Unit");
$businessunit_id->setAttrib('class', 'selectoption');
if ($postid == '') {
$businessunit_id->setAttrib('onchange', 'displayDept(this)');
$bunitdata = $this->bunitdata;
if (!empty($bunitdata)) {
$businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit'));
foreach ($bunitdata as $data) {
$businessunit_id->addMultiOption($data['id'], $data['unitname']);
}
} else {
$businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
}
} else {
$businessunit_id->addMultiOptions(array('' => 'Select Business unit'));
}
$businessunit_id->setRegisterInArrayValidator(false);
$businessunit_id->setRequired(true);
$businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
$department_id = new Zend_Form_Element_Select('department_id');
$department_id->setLabel("Department");
$department_id->setAttrib('class', 'selectoption');
$department_id->addMultiOption('', 'Select Department');
if ($postid == '') {
$department_id->setAttrib('onchange', 'displayDept(this)');
}
$department_id->setRegisterInArrayValidator(false);
$performance_app_flag = new Zend_Form_Element_Radio('performance_app_flag');
$performance_app_flag->setLabel("Applicability");
$performance_app_flag->setAttrib('onclick', 'checkimplementfun(this)');
$performance_app_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise'));
$performance_app_flag->setSeparator('');
$performance_app_flag->setValue(1);
$performance_app_flag->setRegisterInArrayValidator(false);
$performance_app_flag->setRequired(true);
$performance_app_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.'));
$appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
$appraisal_mode->setLabel("Appraisal Mode");
$appraisal_mode->setAttrib('class', 'selectoption');
$appraisal_mode->addMultiOptions(array('' => 'Select appraisal mode', 'Quarterly' => 'Quarterly', 'Half-yearly' => 'Half-yearly', 'Yearly' => 'Yearly'));
$appraisal_mode->setRegisterInArrayValidator(false);
$appraisal_mode->setRequired(true);
$appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal mode.'));
$appraisal_ratings = new Zend_Form_Element_Select('appraisal_ratings');
$appraisal_ratings->setLabel("Appraisal Ratings");
$appraisal_ratings->setAttrib('class', 'selectoption');
$appraisal_ratings->addMultiOptions(array('' => 'Select ratings', '1' => '1-5', '2' => '1-10'));
$appraisal_ratings->setRegisterInArrayValidator(false);
$appraisal_ratings->setRequired(true);
$appraisal_ratings->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal ratings.'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $businessunit_id, $performance_app_flag, $department_id, $appraisal_mode, $appraisal_ratings, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例8: getForm
public function getForm($data, $protection = 0)
{
$elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
$form = new Zend_Form();
$form->setAction('/user/registration/first-form/')->setMethod('post');
//firstname field
$firstName = new Zend_Form_Element_Text('firstname', array('maxLength' => '30', 'id' => 'name', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
if (isset($data['u_name'])) {
$firstName->setValue($data['u_name']);
}
if ($protection) {
$firstName->setAttrib('readonly', 'true');
}
$firstName->setDecorators($elementDecorators);
//lastname field
$lastName = new Zend_Form_Element_Text('lastname', array('maxLength' => '30', 'id' => 'lname', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
$lastName->setDecorators($elementDecorators);
if (isset($data['u_family_name'])) {
$lastName->setValue($data['u_family_name']);
}
if ($protection) {
$lastName->setAttrib('readonly', 'true');
}
//selecting gender: Male (1) or Female (0)
$gender = new Zend_Form_Element_Radio('sex', array('separator' => '', 'multiOptions' => array('1' => 'זכר ', '0' => 'נקבה')));
$gender->setDecorators($elementDecorators);
$gender->setValue($data['u_sex_id']);
if (isset($data['u_sex_id'])) {
$gender->setValue($data['u_sex_id']);
}
if ($protection) {
$gender->setAttrib('readonly', 'true');
}
//birthday field: validation for yyyy-mm-dd input
$birthday = new Zend_Form_Element_Text('datepicker', array('size' => 10));
$birthday->setDecorators($elementDecorators);
if (isset($data['u_date_of_birth'])) {
$birthday->setValue(date("d/m/Y", strtotime($data['u_date_of_birth'])));
}
if ($protection) {
$birthday->setAttrib('readonly', 'true');
}
//heigth
$heigth = new Zend_Form_Element_Select('heigth', array());
for ($i = 120; $i <= 300; $i++) {
$heigth->addMultiOption($i, $i);
}
$heigth->setDecorators($elementDecorators);
if (isset($data['uht_height'])) {
$heigth->setValue($data['uht_height']);
}
if ($protection) {
$heigth->setAttrib('disabled', 'true');
}
//weight
$weight = new Zend_Form_Element_Select('weight', array('label' => ''));
for ($i = 20; $i <= 300; $i++) {
$weight->addMultiOption($i, $i);
}
$weight->setDecorators($elementDecorators);
if (isset($data['uht_weight'])) {
$weight->setValue($data['uht_weight']);
}
//email field with validation
$email = new Zend_Form_Element_Text('email', array());
$email->addValidator(new Zend_Validate_EmailAddress());
$email->setDecorators($elementDecorators);
if (isset($data['u_email'])) {
$email->setValue($data['u_email']);
}
if ($protection) {
$email->setAttrib('readonly', 'true');
}
// password field
$password1 = new Zend_Form_Element_Password('password1', array('id' => 'pass'));
$password1->setDecorators($elementDecorators);
// password confirmation field
$password2 = new Zend_Form_Element_Password('password2', array('id' => 'c_pass'));
$password2->addValidator(new User_Form_UserFirstFormPasswordValidator('password1'));
$password2->setDecorators($elementDecorators);
$state = new Zend_Form_Element_Select('state', array('requred' => true));
$state->setMultiOptions(array('1' => 'מדינה:'));
$state->setDecorators($elementDecorators);
if (isset($data['u_state'])) {
$state->setValue($data['u_state']);
}
$address = new Zend_Form_Element_Text('address', array('required' => false, 'id' => 'full_adr'));
$address->setDecorators($elementDecorators);
if (isset($data['u_address'])) {
$address->setValue($data['u_address']);
}
$pregnant = new Zend_Form_Element_Radio('pregnant', array('separator' => '', 'multioptions' => array('Yes' => 'לא', 'No' => 'כן')));
$pregnant->setDecorators($elementDecorators);
if ($data['uht_pregnant']) {
$pregnant->setValue($data['uht_pregnant']);
}
$pregnantSince = new Zend_Form_Element_Select('pregnantsince', array('id' => 'hz1'));
$pregnantSince->setMultiOptions(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9'));
$pregnantSince->setDecorators($elementDecorators);
if ($data['uht_pregnant']) {
//.........这里部分代码省略.........
示例9: init
public function init()
{
/* Form Elements & Other Definitions Here ... */
$this->setMethod("POST");
$id = new Zend_Form_Element_Hidden("id");
//add firstname
$f_name = new Zend_Form_Element_Text("f_name");
$f_name->setRequired();
$f_name->setLabel("First Name:");
$f_name->setAttrib("placeholder", "Enter Your first Name");
$f_name->addValidator(new Zend_Validate_Alnum("true"));
$f_name->setAttrib("class", "form-control");
$f_name->getDecorator("Label")->setOption("class", "control-label");
$f_name->getDecorator("Errors")->setOption("class", "alert alert-danger");
$f_name->getDecorator("Errors")->setOption("style", " list-style-type:none");
//add lastname
$l_name = new Zend_Form_Element_Text("l_name");
$l_name->setRequired();
$l_name->setLabel("Last Name:");
$l_name->setAttrib("placeholder", "Enter Your last Name");
$l_name->addValidator(new Zend_Validate_Alnum("true"));
$l_name->setAttrib("class", "form-control");
$l_name->getDecorator("Label")->setOption("class", "control-label");
$l_name->getDecorator("Errors")->setOption("class", "alert alert-danger");
$l_name->getDecorator("Errors")->setOption("style", " list-style-type:none");
//add mail
$username = new Zend_Form_Element_Text("username");
$username->setRequired();
$username->setLabel("Username:");
$username->setAttrib("placeholder", "Enter Your E-Mail");
$username->addValidator(new Zend_Validate_EmailAddress());
$username->setAttrib("class", "form-control");
$username->getDecorator("Label")->setOption("class", "control-label");
$username->getDecorator("Errors")->setOption("class", "alert alert-danger");
$username->getDecorator("Errors")->setOption("style", " list-style-type:none");
//add address
$address = new Zend_Form_Element_Text("address");
$address->setLabel("Adress:");
$address->setAttrib("placeholder", "Enter Your adress");
$address->addValidator(new Zend_Validate_Alnum("true"));
$address->setAttrib("class", "form-control");
$address->getDecorator("Label")->setOption("class", "control-label");
$address->getDecorator("Errors")->setOption("class", "alert alert-danger");
$address->getDecorator("Errors")->setOption("style", " list-style-type:none");
//add mobile
$mobile = new Zend_Form_Element_Text("mobile");
$mobile->setLabel("Mobile:");
$mobile->setAttrib("placeholder", "Enter Your mobile");
$mobile->addValidator(new Zend_Validate_Alnum("true"));
$mobile->setAttrib("class", "form-control");
$mobile->getDecorator("Label")->setOption("class", "control-label");
$mobile->getDecorator("Errors")->setOption("class", "alert alert-danger");
$mobile->getDecorator("Errors")->setOption("style", " list-style-type:none");
//add phone
$phone = new Zend_Form_Element_Text("phone");
$phone->setLabel("Phone:");
$phone->setAttrib("placeholder", "Enter Your phone");
$phone->addValidator(new Zend_Validate_Alnum("true"));
$phone->setAttrib("class", "form-control");
$phone->getDecorator("Label")->setOption("class", "control-label");
$phone->getDecorator("Errors")->setOption("class", "alert alert-danger");
$phone->getDecorator("Errors")->setOption("style", " list-style-type:none");
//add checkbox
$status = new Zend_Form_Element_Radio("active");
$status->addMultiOptions(array('1' => 'Active', '0' => 'Notactive'));
$status->setLabel('What is your status ?');
$status->setAttrib("class", "form-control");
$status->getDecorator("Label")->setOption("class", "control-label");
$status->setRequired();
$user_type = new Zend_Form_Element_Radio("user_type");
$user_type->addMultiOptions(array('admin' => 'Admin', 'normal' => 'Normal'));
$user_type->setLabel('User Type');
$user_type->setAttrib("class", "form-control");
$user_type->getDecorator("Label")->setOption("class", "control-label");
$user_type->setRequired();
$password = new Zend_Form_Element_Password("password");
$password->setRequired();
$password->setLabel("Password:");
$password->setAttrib("placeholder", "Enter Your Password");
$password->setAttrib("class", "form-control");
$password->getDecorator("Label")->setOption("class", "control-label");
$password->getDecorator("Errors")->setOption("class", "alert alert-danger");
$password->getDecorator("Errors")->setOption("style", " list-style-type:none");
$re_password = new Zend_Form_Element_Password("re_password");
$re_password->setRequired();
$re_password->setLabel("Retype Your Password:");
$re_password->addValidator('identical', false, array('token' => 'password'));
$re_password->setAttrib("placeholder", "Re-enter Your Password");
$re_password->setAttrib("class", "form-control");
$re_password->getDecorator("Label")->setOption("class", "control-label");
$re_password->getDecorator("Errors")->setOption("class", "alert alert-danger");
$re_password->getDecorator("Errors")->setOption("style", " list-style-type:none");
$submit = new Zend_Form_Element_Submit("submit");
$submit->setAttrib("class", "btn btn-xl center-block");
$this->addElements(array($id, $f_name, $l_name, $username, $address, $password, $re_password, $mobile, $phone, $status, $user_type, $submit));
// Add a captcha
/*$this->addElement('captcha', 'captcha', array(
'label' => 'Please enter the 5 letters displayed below:',
'required' => true,
'captcha' => array(
//.........这里部分代码省略.........