本文整理汇总了PHP中Zend_Form_Element_Text::setAttrib方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::setAttrib方法的具体用法?PHP Zend_Form_Element_Text::setAttrib怎么用?PHP Zend_Form_Element_Text::setAttrib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::setAttrib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'agencylistreport');
$this->setAttrib('name', 'agencylistreport');
$this->setAttrib('action', DOMAIN . 'reports/agencylistreport');
$agencyname = new Zend_Form_Element_Text('agencynamef');
$agencyname->setLabel('Agency');
$agencyname->setAttrib('onblur', 'clearagencyname(this)');
$agencyname->setAttrib('maxLength', 50);
$primaryphone = new Zend_Form_Element_Text('primaryphonef');
$primaryphone->setLabel('Primary Phone');
$primaryphone->setAttrib('onblur', 'blurelement(this)');
$primaryphone->setAttrib('maxLength', 15);
$primaryphone->addFilter(new Zend_Filter_StringTrim());
$primaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Primary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Primary phone number must contain at least %min% characters.')))));
$primaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.')));
$checktype = new Zend_Form_Element_Multiselect('bg_checktypef');
$checktype->setLabel('Screening Type');
$checktypeModal = new Default_Model_Bgscreeningtype();
$typesData = $checktypeModal->fetchAll('isactive=1', 'type');
foreach ($typesData->toArray() as $data) {
$checktype->addMultiOption($data['id'], $data['type']);
}
$checktype->setRegisterInArrayValidator(false);
$checktype->setAttrib('onchange', 'changeelement(this)');
$website = new Zend_Form_Element_Text('website_urlf');
$website->setLabel('Website Url');
$website->setAttrib('maxLength', 50);
$website->addFilter(new Zend_Filter_StringTrim());
$website->setAttrib('onblur', 'clearagencyname(this)');
$this->addElements(array($agencyname, $primaryphone, $checktype, $website));
$this->setElementDecorators(array('ViewHelper'));
}
示例2: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'empscreeningreport');
$this->setAttrib('action', BASE_URL . 'reports/empscreening');
$specimen = new Zend_Form_Element_Select('specimen');
$specimen->setLabel('Select Employee/Candidate');
$specimen->addMultiOption('', 'Select Employee/Candidate');
$specimen->addMultiOption('1', 'Employee');
$specimen->addMultiOption('2', 'Candidate');
$empname = new Zend_Form_Element_Text('empname');
$empname->setLabel('Employee / Candidate Name');
$empname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.\\-]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
$empname->setAttrib('onblur', 'clearEmpScreeningAutoCompleteNames(this)');
$agencyname = new Zend_Form_Element_Text('agencyname');
$agencyname->setLabel('Agency Name');
$agencyname->setAttrib('class', 'selectoption');
$agencyname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.\\-]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
$agencyname->setAttrib('onblur', 'clearEmpScreeningAutoCompleteNames(this)');
$screeningtype = new Zend_Form_Element_Multiselect('screeningtype');
$screeningtype->setLabel('Screening Type');
$checktypeModal = new Default_Model_Bgscreeningtype();
$typesData = $checktypeModal->fetchAll('isactive=1', 'type');
foreach ($typesData->toArray() as $data) {
$screeningtype->addMultiOption($data['id'], $data['type']);
}
$screeningtype->setRegisterInArrayValidator(false);
$process_status = new Zend_Form_Element_Select('process_status');
$process_status->setLabel('Select Status');
$process_status->addMultiOption('', 'Select Status');
$process_status->addMultiOption('In process', 'In process');
$process_status->addMultiOption('Complete', 'Complete');
$process_status->addMultiOption('On hold', 'On hold');
$month = new Zend_Form_Element_Select('month');
$month->setLabel('Select Month');
$month->addMultiOption('', 'Select Month');
$monthnamesarray = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
for ($i = 1; $i <= sizeof($monthnamesarray); $i++) {
$month->addMultiOption($i, $monthnamesarray[$i]);
}
$year = new Zend_Form_Element_Select('year');
$year->setLabel('Select Year');
$curYear = date("Y");
$preYear = $curYear - 10;
$year->addMultiOption('', 'Select Year');
for ($i = $preYear; $i <= $curYear; $i++) {
$year->addMultiOption($i, $i);
}
$this->addElements(array($specimen, $empname, $agencyname, $screeningtype, $process_status, $month, $year));
$this->setElementDecorators(array('ViewHelper'));
}
示例3: init
public function init()
{
// attribs
$this->setAttribs(array('id' => 'form-site-contato'));
$this->setMethod('post');
$this->setAction('contato/');
// contato_nome
$contato_nome = new Zend_Form_Element_Text('contato_nome');
$contato_nome->setLabel("Nome:");
$contato_nome->setRequired();
$contato_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$contato_nome->setAttrib('class', 'form-control');
$contato_nome->setAttrib('placeholder', 'Informe seu nome');
$contato_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
// contato_email
$contato_email = new Zend_Form_Element_Text('contato_email');
$contato_email->setLabel("E-mail:");
$contato_email->setRequired();
$contato_email->addErrorMessages(array(Zend_Validate_EmailAddress::INVALID => "Email inválido!"));
$contato_email->addValidator('EmailAddress');
$contato_email->setAttrib('class', 'form-control');
$contato_email->setAttrib('placeholder', 'Informe seu email');
$contato_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
// contato_mensagem
$contato_mensagem = new Zend_Form_Element_Textarea('contato_mensagem');
$contato_mensagem->setLabel("Mensagem:");
$contato_mensagem->setRequired();
$contato_mensagem->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$contato_mensagem->setAttrib('class', 'form-control');
$contato_mensagem->setAttrib('placeholder', 'Digite aqui sua mensagem');
$contato_mensagem->setAttrib('rows', 5);
$contato_mensagem->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$this->addElements(array($contato_nome, $contato_email, $contato_mensagem));
parent::init();
}
示例4: __construct
public function __construct($options = null)
{
parent::__construct($options);
parent::__construct();
$accountCode = new Zend_Form_Element_Hidden('accountcode');
$memberId = new Zend_Form_Element_Hidden('membercode');
$categoryId = new Zend_Form_Element_Hidden('categoryId');
$newStatus = new Zend_Form_Element_Select('newStatus');
$newStatus->setAttrib('class', 'NormalBtn');
$newStatus->setRequired(true);
$newStatus->addMultiOption('', 'Select...');
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('rows', '2');
$description->setAttrib('cols', '20');
$description->setRequired(true);
$totalamount = new Zend_Form_Element_Text('totalamount');
$totalamount->setAttrib('class', 'textfield');
$totalamount->setAttrib('id', 'totalamount');
$totalamount->setAttrib('readonly', 'true');
$newStatus1 = new Zend_Form_Element_Hidden('newStatus1');
$description1 = new Zend_Form_Element_Hidden('description1');
$totalamount1 = new Zend_Form_Element_Hidden('totalamount1');
$confirm = new Zend_Form_Element_Submit('confirm');
$confirm->setAttrib('class', 'officesubmit');
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setAttrib('class', 'officesubmit');
$this->addElements(array($submit, $newStatus, $description, $accountCode, $memberId, $categoryId, $totalamount, $confirm, $newStatus1, $description1, $totalamount1));
}
示例5: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'businessunitsreport');
$this->setAttrib('action', BASE_URL . 'reports/businessunits');
$bunitname = new Zend_Form_Element_Text('bunitname');
$bunitname->setLabel('Business Unit');
$bunitname->setAttrib('onblur', 'clearbuname(this)');
$bunitcode = new Zend_Form_Element_Text('bunitcode');
$bunitcode->setLabel('Code');
$bunitcode->setAttrib('onblur', 'clearbuname(this)');
$bunitcode->setAttrib('class', 'selectoption');
$startdate = new ZendX_JQuery_Form_Element_DatePicker('startdate');
$startdate->setLabel('Started On');
$startdate->setAttrib('readonly', 'true');
$startdate->setOptions(array('class' => 'brdr_none'));
$start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date');
$start_date->setAttrib('readonly', 'true');
$start_date->setAttrib('onfocus', 'this.blur()');
$start_date->setOptions(array('class' => 'brdr_none'));
$country = new Zend_Form_Element_Select('country');
$country->setLabel('Country');
$this->addElements(array($bunitname, $bunitcode, $startdate, $country));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('startdate'));
}
示例6: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'empleaves');
$id = new Zend_Form_Element_Hidden('id');
$userid = new Zend_Form_Element_Hidden('user_id');
$emp_leave_limit = new Zend_Form_Element_Text('leave_limit');
$emp_leave_limit->setAttrib('maxLength', 3);
$emp_leave_limit->addFilter(new Zend_Filter_StringTrim());
$emp_leave_limit->setRequired(true);
$emp_leave_limit->addValidator('NotEmpty', false, array('messages' => 'Please enter leave limit for current year.'));
$emp_leave_limit->addValidator("regex", true, array('pattern' => '/^(\\-?[1-9]|\\-?[1-9][0-9])$/', 'messages' => array('regexNotMatch' => 'Leave limit must be in the range of 0 to 100.')));
$used_leaves = new Zend_Form_Element_Text('used_leaves');
$used_leaves->setAttrib('maxLength', 3);
$used_leaves->setAttrib('readonly', 'true');
$used_leaves->setAttrib('onfocus', 'this.blur()');
$alloted_year = new Zend_Form_Element_Text('alloted_year');
$alloted_year->setAttrib('maxLength', 4);
$alloted_year->setAttrib('readonly', 'true');
$alloted_year->setAttrib('onfocus', 'this.blur()');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$submitbutton = new Zend_Form_Element_Button('submitbutton');
$submitbutton->setAttrib('id', 'submitbuttons');
$submitbutton->setLabel('Save');
$this->addElements(array($id, $userid, $emp_leave_limit, $used_leaves, $alloted_year, $submit, $submitbutton));
$this->setElementDecorators(array('ViewHelper'));
}
示例7: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'frm_interview_rpt');
$interview_date = new Zend_Form_Element_Text("interview_date");
$interview_date->setLabel("Interview Date");
$interview_date->setAttrib('readonly', 'readonly');
$req_id = new Zend_Form_Element_Select("req_id");
$req_id->setRegisterInArrayValidator(false);
$req_id->setLabel("Requisition Code")->addMultiOptions(array('' => 'Select Requisition Code'));
$department_id = new Zend_Form_Element_Select("department_id");
$department_id->setLabel("Department");
$department_id->setRegisterInArrayValidator(false);
$department_id->addMultiOptions(array('' => 'Select Department'));
$interviewer_id = new Zend_Form_Element_Text("interviewer_id");
$interviewer_id->setLabel("Interviewer");
$interviewer_id->setAttrib('name', '');
$interviewer_id->setAttrib('id', 'idinterviewer_id');
$createdby = new Zend_Form_Element_Text("createdby");
$createdby->setLabel("Interview Planned By");
$createdby->setAttrib('name', '');
$createdby->setAttrib('id', 'idcreatedby');
$submit = new Zend_Form_Element_Button('submit');
$submit->setAttrib('id', 'idsubmitbutton');
$submit->setLabel('Report');
$this->addElements(array($submit, $interview_date, $req_id, $department_id, $interviewer_id, $createdby));
$this->setElementDecorators(array('ViewHelper'));
}
示例8: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'frm_requisition_report');
$raised_by = new Zend_Form_Element_Text("raised_by");
$raised_by->setLabel("Raised By");
$raised_by->setAttrib('name', '');
$raised_by->setAttrib('id', 'idraised_by');
$raised_by->setAttrib('title', 'Raised By');
$requisition_status = new Zend_Form_Element_Select("req_status");
$requisition_status->setLabel("Requisition Status");
$requisition_status->addMultiOptions(array('' => 'Select Requisition Status', 'Initiated' => 'Initiated', 'Approved' => 'Approved', 'Rejected' => 'Rejected', 'Closed' => 'Closed', 'On hold' => 'On hold', 'Complete' => 'Complete', 'In process' => 'In process'));
$requisition_status->setAttrib('title', 'Requisition Status');
$raised_in = new Zend_Form_Element_Select('createdon');
$raised_in->setLabel('Raised In');
$raised_in->setAttrib('id', 'createdon');
$reporting_manager = new Zend_Form_Element_Text("reporting_manager");
$reporting_manager->setLabel("Reporting Manager");
$reporting_manager->setAttrib('name', '');
$reporting_manager->setAttrib('id', 'idreporting_manager');
$job_title = new Zend_Form_Element_Select("jobtitle");
$job_title->setLabel("Job Title");
$job_title->setAttrib("onchange", "getpositions_req('department','business_unit','position_id','jobtitle');");
$job_title->setAttrib('title', 'Job Title.');
$submit = new Zend_Form_Element_Button('submit');
$submit->setAttrib('id', 'idsubmitbutton');
$submit->setLabel('Report');
$this->addElements(array($raised_by, $requisition_status, $raised_in, $reporting_manager, $job_title, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例9: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'pdcategories');
$this->setAttrib('name', 'pdcategories');
$categoryName = new Zend_Form_Element_Text('category');
$categoryName->setAttrib('id', 'category');
$categoryName->setAttrib('name', 'category');
$categoryName->setAttrib('maxlength', '30');
$categoryName->setAttrib('onblur', 'chkCategory()');
$categoryName->setAttrib('onkeypress', 'chkCategory()');
$categoryName->addFilter(new Zend_Filter_StringTrim());
$categoryName->setRequired(true);
$categoryName->addValidator('NotEmpty', false, array("messages" => 'Please enter category'));
$categoryName->addValidator('regex', true, array('pattern' => '/^[a-zA-Z0-9][\\s+[a-zA-Z0-9]+]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid category')));
$categoryName->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pd_categories', 'field' => 'category', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
$categoryName->getValidator('Db_NoRecordExists')->setMessage('Category already exists');
$categoryDesc = new Zend_Form_Element_Textarea('description');
$categoryDesc->setAttrib('id', 'description');
$categoryDesc->setAttrib('name', 'description');
$categoryDesc->setAttrib('rows', 10);
$categoryDesc->setAttrib('cols', 50);
$categoryDesc->setAttrib('maxlength', 250);
$submitBtn = new Zend_Form_Element_Submit('submit');
$submitBtn->setAttrib('id', 'submitBtn');
$submitBtn->setLabel('Add');
$this->addElements(array($categoryName, $categoryDesc, $submitBtn));
$this->setElementDecorators(array('ViewHelper'));
}
示例10: init
public function init()
{
$this->setMethod('post');
$this->setAction('/main/new');
$this->setAttrib('id', 'newRoute');
$note = new Zend_Form_Element_Note('title', array('value' => '<h2 id="titleProductDetails">Create a New Route</h2>'));
$intermed = new Zend_Form_Element_Hidden('intermed');
$intermed->setAttrib('readonly', 'readonly');
$intermed->addFilter('StripTags');
$intermed->addFilter('HtmlEntities');
$intermed->addFilter('StringTrim');
$start = new Zend_Form_Element_Text('startForm');
$start->setLabel('Starting Point*');
$start->setAttrib('autocomplete', 'off');
$start->addFilter('StripTags');
$start->addFilter('HtmlEntities');
$start->setAttrib('class', 'form-control');
$start->addFilter('StringTrim');
$start->setRequired(true)->addErrorMessage('Start Location Required');
// $start->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\s]*$/'))->addErrorMessage('Invalid characters used');
// $start->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$end = new Zend_Form_Element_Text('endForm');
$end->setLabel('Destination*');
$end->setAttrib('autocomplete', 'off');
$end->addFilter('StripTags');
$end->setAttrib('class', 'form-control');
$end->addFilter('HtmlEntities');
$end->addFilter('StringTrim');
$end->setRequired(true)->addErrorMessage('Destination Required');
// $end->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$routeDate = new Zend_Form_Element_Text('routeDate');
$routeDate->setAttrib('autocomplete', 'off');
$routeDate->setAttrib('readonly', 'readonly');
$routeDate->setAttrib('maxlength', '10');
$routeDate->setAttrib('class', 'form-control');
$routeDate->setLabel('Date of Journey' . '*');
$routeDate->addFilter('StripTags');
$routeDate->addFilter('HtmlEntities');
$routeDate->addFilter('StringTrim');
$routeDate->setRequired(true)->addErrorMessage('Date Required');
$routeDate->addValidator('Regex', true, array('/^[0-9.\\s]*$/'))->addErrorMessage('Invalid characters used');
$routeDate->addValidator('StringLength', true, array(10, 10))->addErrorMessage('Required Field');
$passangers = new Zend_Form_Element_Select('passangers');
$passangers->setLabel('No of Passangers*');
$passangers->setAttrib('autocomplete', 'off');
$passangers->setAttrib('class', 'form-control');
$passangers->addFilter('StripTags');
$passangers->addFilter('HtmlEntities');
$passangers->addFilter('StringTrim');
$passangers->setRequired(true)->addErrorMessage('Password Required');
$passangers->setMultiOptions(array('1' => '1 Passanger', '2' => '2 Passangers', '3' => '3 Passangers', '4' => '4 Passangers', '5' => '5 Passangers', '6' => '6 Passangers'));
$submit = new Zend_Form_Element_Submit('newRoute');
$submit->setLabel('New Route');
$submit->setAttrib('class', 'btn btn-info');
$submit->setAttrib('style', 'margin-top:20px');
$this->addElements(array($note, $intermed, $start, $end, $passangers, $routeDate, $submit));
$this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
$submit->setDecorators(array('ViewHelper'));
$this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'div', 'id' => 'newRouteFormContainer'))));
}
示例11: __construct
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');
$memberaddressline1 = new Zend_Form_Element_Text('memberaddressline1');
$memberaddressline1->setAttrib('class', 'txt_put');
$memberaddressline1->setAttrib('id', 'memberaddressline1');
$memberaddressline1->setAttrib('tabindex', '13');
$memberaddressline1->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');
$memberaddressline3 = new Zend_Form_Element_Text('memberaddressline3');
$memberaddressline3->setAttrib('class', 'txt_put');
$memberaddressline3->setAttrib('id', 'memberaddressline3');
$memberaddressline3->setAttrib('tabindex', '15');
$memberaddressline3->setAttrib($value, 'true');
$membercity = new Zend_Form_Element_Text('membercity');
$membercity->setAttrib('class', 'txt_put');
$membercity->setAttrib('id', 'membercity');
$membercity->setAttrib('tabindex', '16');
$membercity->setAttrib($value, 'true');
$familymembername = new Zend_Form_Element_Text('familymembername');
$familymembername->setAttrib('class', 'txt_put');
$familymembername->setAttrib('size', '10');
$familymembername->setAttrib('id', 'familymembername');
$memberId = new Zend_Form_Element_Text('member_id');
$memberId->setAttrib('class', 'txt_put');
$memberId->setAttrib('readonly', 'true');
$memberId->setAttrib('size', '10');
$OFFICE_TYPE = new Zend_Form_Element_Select('officeType');
$OFFICE_TYPE->addMultiOption('', 'Select');
$OFFICE_TYPE->setAttrib('class', 'txt_put');
$OFFICE_TYPE->setAttrib('onchange', 'getBranch(this.value,"' . $app . '")');
$OFFICE_TYPE->setAttrib('tabindex', '1');
$OFFICE_TYPE->setAttrib($value, 'true');
$SUB_OFFICE = new Zend_Form_Element_Select('subOffice');
$SUB_OFFICE->setAttrib('class', 'txt_put');
$SUB_OFFICE->setAttrib('tabindex', '2');
$SUB_OFFICE->setAttrib($value, 'true');
$submit = new Zend_Form_Element_Submit('Save');
$submit->setAttrib('id', 'save');
$this->addElements(array($OFFICE_TYPE, $SUB_OFFICE, $memberfirstname, $familymembername, $membertitle, $memberaddressline1, $memberaddressline2, $memberaddressline3, $membercity, $submit, $memberId));
$memberId = new Zend_Form_Element_Hidden('memberId');
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setAttrib('class', 'officesubmit');
$this->addElements(array($submit, $memberId));
}
示例12: __construct
public function __construct($currencysymbol)
{
Zend_Dojo::enableForm($this);
parent::__construct($options);
$finename = new Zend_Form_Element_Text('finename');
$finename->setRequired(true)->addValidators(array(array('NotEmpty')));
$finename->setAttrib('class', 'txt_put');
$finename->setAttrib('id', 'finename');
$membertype = new Zend_Form_Element_Select('membertype');
$membertype->setAttrib('class', 'selectbutton');
$membertype->setAttrib('id', 'membertype');
$membertype->setRequired(true)->addValidators(array(array('NotEmpty')));
$finedescription = new Zend_Form_Element_Text('finedescription');
$finedescription->setAttrib('class', 'txt_put');
$finedescription->setAttrib('id', 'finedescription');
$finedescription->setRequired(true)->addValidators(array(array('NotEmpty')));
$finevalue = new Zend_Form_Element_Text('finevalue');
$finevalue->setAttrib('class', 'txt_put');
$finevalue->setAttrib('id', 'finevalue');
$finevalue->setAttrib('size', '6');
$finevalue->setRequired(true)->addValidators(array(array('NotEmpty')));
$submit = new Zend_Form_Element_Submit('Save');
$submit->setAttrib('id', 'save');
$this->addElements(array($finename, $finedescription, $membertype, $finevalue));
$fineId = new Zend_Form_Element_Hidden('fineId');
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setAttrib('class', 'finesubmit');
$submit->setLabel('submit');
$this->addElements(array($submit, $fineId));
}
示例13: init
public function init()
{
$this->setMethod('post');
// $this->setAction('/index/login');
$this->setAttrib('id', 'msform');
$email = new Zend_Form_Element_Text('email');
$email->setAttrib('placeholder', 'E-mail');
$email->setAttrib('autocomplete', 'off');
$email->addFilter('StripTags');
$email->addFilter('HtmlEntities');
$email->addFilter('StringTrim');
$email->setRequired(true)->addErrorMessage('Username Required');
$email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used');
$email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$password = new Zend_Form_Element_Password('password');
$password->setAttrib('placeholder', 'Password');
$password->setAttrib('autocomplete', 'off');
$password->addFilter('StripTags');
$password->addFilter('HtmlEntities');
$password->addFilter('StringTrim');
$password->setRequired(true)->addErrorMessage('Password Required');
$password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$link = new Zend_Form_Element_Note('forgot_password', array('value' => '<a href="#" id="link">Forgot your password ?</a>'));
$submit = new Zend_Form_Element_Submit('SignIn');
$submit->setLabel('Sign In');
$submit->setAttrib('class', 'btn btn-info');
$register = new Zend_Form_Element_Button('register');
$register->setLabel('Register');
$register->setAttrib('class', 'btn btn-warning');
$this->addElements(array($email, $password, $submit, $register, $link));
$this->setElementDecorators(array('ViewHelper'));
$submit->setDecorators(array('ViewHelper'));
$register->setDecorators(array('ViewHelper'));
$this->setDecorators(array('FormElements', 'Form'));
}
示例14: init
public function init()
{
$this->setMethod("post");
$title = new Zend_Form_Element_Text("title");
$title->setAttrib("placeholder", "Title");
$title->setAttrib("class", "form-control");
$title->setLabel("Title: ");
$title->setRequired();
$body = new Zend_Form_Element_Textarea("body");
$body->setAttrib("class", "form-control");
$body->setAttrib("placeholder", "Write body here....");
$body->setLabel("Body: ");
$body->setAttrib("rows", "5");
$body->setAttrib("cols", "55");
$body->setRequired();
$picture = new Zend_Form_Element_File('picture');
$picture->setLabel("Picture:");
$picture->setRequired();
$picture->setDestination('/var/www/html/RNR/public/images/thread');
$stick = new Zend_Form_Element_Radio("stick");
$stick->setLabel("Sticky:");
$stick->addMultiOption("on", "on");
$stick->addMultiOption("off", "off");
$stick->setRequired();
$id = new Zend_Form_Element_Hidden("id");
$submit = new Zend_Form_Element_Submit("Submit");
$submit->setAttrib("class", "btn btn-primary");
$submit->setLabel("Save");
$rest = new Zend_Form_Element_Submit('Rest');
$rest->setAttrib("class", "btn btn-info");
$this->addElements(array($id, $title, $body, $picture, $stick, $submit, $rest));
}
示例15: getFormLogin
private function getFormLogin()
{
$form = new Zend_Form(array('disableLoadDefaultDecorators' => true));
$email = new Zend_Form_Element_Text('login', array('disableLoadDefaultDecorators' => true));
$email->addDecorator('ViewHelper');
$email->addDecorator('Errors');
$email->setRequired(true);
$email->setAttrib('class', 'form-control');
$email->setAttrib('placeholder', 'Login');
$email->setAttrib('required', 'required');
$email->setAttrib('autofocus', 'autofocus');
$password = new Zend_Form_Element_Password('password', array('disableLoadDefaultDecorators' => true));
$password->addDecorator('ViewHelper');
$password->addDecorator('Errors');
$password->setRequired(true);
$password->setAttrib('class', 'form-control');
$password->setAttrib('placeholder', 'Hasło');
$password->setAttrib('required', 'required');
$password->setAttrib('autofocus', 'autofocus');
$submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true));
$submit->setAttrib('class', 'btn btn-lg btn-primary btn-block');
$submit->setOptions(array('label' => 'Zaloguj'));
$submit->addDecorator('ViewHelper')->addDecorator('Errors');
$form->addElement($email)->addElement($password)->addElement($submit);
return $form;
}