本文整理汇总了PHP中Zend_Form_Element_Text::addValidators方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::addValidators方法的具体用法?PHP Zend_Form_Element_Text::addValidators怎么用?PHP Zend_Form_Element_Text::addValidators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::addValidators方法的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', 'identitycodes');
$id = new Zend_Form_Element_Hidden('id');
//Employee Code
$empCode = new Zend_Form_Element_Text('employee_code');
$empCode->addFilter(new Zend_Filter_StringTrim());
$empCode->setAttrib('maxLength', 5);
$empCode->setRequired(true);
$empCode->addValidator('NotEmpty', false, array('messages' => 'Please enter employee code.'));
$empCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Employee code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Employee code must contain at least %min% characters.')))));
$empCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid employee code.')))));
// Background Agency Code
$bgCode = new Zend_Form_Element_Text('bg_code');
$bgCode->addFilter(new Zend_Filter_StringTrim());
$bgCode->setRequired(true);
$bgCode->setAttrib('maxLength', 5);
$bgCode->addValidator('NotEmpty', false, array('messages' => 'Please enter background agency code.'));
$bgCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Background Agency code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Background Agency code must contain at least %min% characters.')))));
$bgCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid background agency code.')))));
// Vendors Code
$vendorsCode = new Zend_Form_Element_Text('vendor_code');
$vendorsCode->addFilter(new Zend_Filter_StringTrim());
$vendorsCode->setAttrib('maxLength', 5);
$vendorsCode->setRequired(true);
$vendorsCode->addValidator('NotEmpty', false, array('messages' => 'Please enter vendor code.'));
$vendorsCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Vendor code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Vendor code must contain at least %min% characters.')))));
$vendorsCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid vendor code.')))));
// Staffing Code
$staffingCode = new Zend_Form_Element_Text('staffing_code');
$staffingCode->setAttrib('maxLength', 5);
$staffingCode->addFilter(new Zend_Filter_StringTrim());
$staffingCode->setRequired(true);
$staffingCode->addValidator('NotEmpty', false, array('messages' => 'Please enter staffing code.'));
$staffingCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Staffing code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Staffing code must contain at least %min% characters.')))));
$staffingCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid staffing code.')))));
$users_code = new Zend_Form_Element_Text('users_code');
$users_code->setAttrib('maxLength', 5);
$users_code->addFilter(new Zend_Filter_StringTrim());
$users_code->setRequired(true);
$users_code->addValidator('NotEmpty', false, array('messages' => 'Please enter users code.'));
$users_code->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Users code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Users code must contain at least %min% characters.')))));
$users_code->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid users code.')))));
$requisition_code = new Zend_Form_Element_Text('requisition_code');
$requisition_code->setAttrib('maxLength', 5);
$requisition_code->addFilter(new Zend_Filter_StringTrim());
$requisition_code->setRequired(true);
$requisition_code->addValidator('NotEmpty', false, array('messages' => 'Please enter requisition code.'));
$requisition_code->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Requisition code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Requisition code must contain at least %min% characters.')))));
$requisition_code->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid requisition code.')))));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $empCode, $bgCode, $vendorsCode, $staffingCode, $submit, $users_code, $requisition_code));
$this->setElementDecorators(array('ViewHelper'));
}
示例3: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'workeligibilitydetails');
$id = new Zend_Form_Element_Hidden('id');
$userid = new Zend_Form_Element_Hidden('user_id');
$emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
$issuingauthflag = new Zend_Form_Element_Hidden('issuingauthflag');
//Document type Id....
$docType = new Zend_Form_Element_Select('documenttype_id');
$docType->setRegisterInArrayValidator(false);
$docType->setAttrib('onchange', 'checkissuingauthority(this)');
$docType->addMultiOption('', 'Select Document Type');
//Document Issue Date...
$doc_issue_date = new ZendX_JQuery_Form_Element_DatePicker('doc_issue_date');
$doc_issue_date->setOptions(array('class' => 'brdr_none'));
$doc_issue_date->setAttrib('readonly', 'true');
$doc_issue_date->setAttrib('onfocus', 'this.blur()');
// Document Expiry Date...
$doc_expiry_date = new ZendX_JQuery_Form_Element_DatePicker('doc_expiry_date');
$doc_expiry_date->setAttrib('readonly', 'true');
$doc_expiry_date->setAttrib('onfocus', 'this.blur()');
$doc_expiry_date->setOptions(array('class' => 'brdr_none'));
// Expiration Date should be greater than today's date...
// issuing authority name...
$issueAuth_name = new Zend_Form_Element_Text('issuingauth_name');
$issueAuth_name->setAttrib('maxLength', 50);
$issueAuth_name->addFilter(new Zend_Filter_StringTrim());
$issueAuth_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\&\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid name.')))));
//issuing authority country.....
$country = new Zend_Form_Element_Select('issuingauth_country');
$country->setAttrib('onchange', 'displayParticularState(this,"","issuingauth_state","")');
$country->setRegisterInArrayValidator(false);
//issuing authority state.....
$state = new Zend_Form_Element_Select('issuingauth_state');
$state->setAttrib('onchange', 'displayParticularCity(this,"","issuingauth_city","")');
$state->setRegisterInArrayValidator(false);
$state->addMultiOption('', 'Select State');
//issuing authority city.....
$city = new Zend_Form_Element_Select('issuingauth_city');
$city->setRegisterInArrayValidator(false);
$city->addMultiOption('', 'Select City');
//issuing authority postal code .....
$issuingAuth_pcode = new Zend_Form_Element_Text('issuingauth_postalcode');
$issuingAuth_pcode->addFilter(new Zend_Filter_StringTrim());
$issuingAuth_pcode->setAttrib("maxlength", 10);
$issuingAuth_pcode->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Issuing authority postal code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Issuing authority postal code must contain at least %min% characters.')))));
$issuingAuth_pcode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?!0{3})[0-9a-zA-Z]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid postal code.')))));
// Form Submit .........
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $userid, $issuingauthflag, $docType, $doc_issue_date, $doc_expiry_date, $issueAuth_name, $country, $state, $city, $issuingAuth_pcode, $emptyflag, $submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('doc_issue_date', 'doc_expiry_date'));
}
示例4: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'positions');
$id = new Zend_Form_Element_Hidden('id');
$emptyflag = new Zend_Form_Element_Hidden('emptyFlag');
$positionname = new Zend_Form_Element_Text('positionname');
$positionname->setAttrib('maxLength', 50);
$positionname->setRequired(true);
$positionname->addValidator('NotEmpty', false, array('messages' => 'Please enter position.'));
$positionname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid position.')))));
$positionname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_positions', 'field' => 'positionname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
$positionname->getValidator('Db_NoRecordExists')->setMessage('Position already exists.');
$jobtitleid = new Zend_Form_Element_Select('jobtitleid');
$jobtitleid->setAttrib('class', 'selectoption');
$jobtitleid->setRegisterInArrayValidator(false);
$jobtitleid->addMultiOption('', 'Select Job Title');
$jobtitleid->setRequired(true);
$jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
$description = new Zend_Form_Element_Textarea('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, $positionname, $jobtitleid, $description, $emptyflag, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例5: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', DOMAIN . 'employee/add');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'empskills');
$id = new Zend_Form_Element_Hidden('id');
$userid = new Zend_Form_Element_Hidden('user_id');
$skillname = new Zend_Form_Element_Text('skillname');
$skillname->setRequired(true);
$skillname->setAttrib('maxLength', 50);
$skillname->addFilter('StripTags');
$skillname->addFilter('StringTrim');
$skillname->addValidator('NotEmpty', false, array('messages' => 'Please enter skill.'));
$yearsofexp = new Zend_Form_Element_Text('yearsofexp');
$yearsofexp->setAttrib('maxLength', 5);
$yearsofexp->addFilter(new Zend_Filter_StringTrim());
$yearsofexp->setRequired(true);
$yearsofexp->addValidator('NotEmpty', false, array('messages' => 'Please enter years of experience.'));
$yearsofexp->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9]\\d{0,1}(\\.\\d*)?$/', 'messages' => array('regexNotMatch' => 'Please enter numbers less than 100.')))));
$competencylevelid = new Zend_Form_Element_Select('competencylevelid');
$competencylevelid->setRequired(true)->addErrorMessage('Please select competency level.');
$competencylevelid->addValidator('NotEmpty', false, array('messages' => 'Please select competency level.'));
$competencylevelid->setRegisterInArrayValidator(false);
$year_skill = new ZendX_JQuery_Form_Element_DatePicker('year_skill_last_used');
$year_skill->setOptions(array('class' => 'brdr_none'));
$year_skill->setAttrib('readonly', 'true');
$year_skill->setAttrib('onfocus', 'this.blur()');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $userid, $skillname, $yearsofexp, $competencylevelid, $year_skill, $submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('year_skill_last_used'));
}
示例6: init
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setAttribs(array('class' => 'form-horizontal'));
$decoratorField = new My_Decorator_FieldLogin();
$elements = array();
// Add email field
$input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
$validator = new Zend_Validate_EmailAddress();
$validator->setOptions(array('domain' => false));
$input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add password field
$input = new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:', 'id' => 'password', 'class' => 'form-control', 'placeholder' => 'Your password..'));
$input->addValidators(array(new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
// Add checkbox field
$input = new Zend_Form_Element_Checkbox('rememberMe', array('label' => 'Remember me', 'id' => 'rememberMe', 'class' => 'checkbox', 'type' => 'checkbox'));
$decoratorCheckBox = new My_Decorator_CheckBox();
$input->addDecorator($decoratorCheckBox);
$elements[] = $input;
$input = new Zend_Form_Element('resetpass', array('label' => 'Reset your password', 'id' => 'resetpass', 'class' => 'form-control', 'value' => 'resetpass'));
$input->addDecorator(new My_Decorator_AnchoraForm());
$elements[] = $input;
//Add Submit button
$input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Login'));
$input->addDecorator($decoratorField);
$elements[] = $input;
$this->addElements($elements);
$this->addDisplayGroup(array('email', 'password', 'resetpass', 'rememberMe', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
}
示例7: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', DOMAIN . 'states/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'states');
$id = new Zend_Form_Element_Hidden('id');
$country = new Zend_Form_Element_Select('countryid');
$country->setAttrib('class', 'selectoption');
$country->setAttrib('onchange', 'displayParticularState(this,"otheroption","state","")');
$country->setRegisterInArrayValidator(false);
$country->addMultiOption('', 'Select Country');
$country->setRequired(true);
$country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
$state = new Zend_Form_Element_Multiselect('state');
$state->setAttrib('onchange', 'displayStateCode(this)');
$state->setRegisterInArrayValidator(false);
$state->setRequired(true);
$state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
$state->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_states', 'field' => 'state_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
$state->getValidator('Db_NoRecordExists')->setMessage('State already exists.');
$otherstatename = new Zend_Form_Element_Text('otherstatename');
$otherstatename->setAttrib('maxLength', 20);
$otherstatename->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[^ ][a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid state name.')))));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $country, $state, $otherstatename, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例8: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('class', 'col-md-9');
$decoratorField = new My_Decorator_Field();
$elements = array();
//render our form elements and the "form" tag
$this->setDecorators(array('FormElements', 'Form'));
$this->setElementDecorators(array('ViewHelper', 'Label'));
// Add Quantity field
$input = new Zend_Form_Element_Text('quantity', array('required' => true, 'class' => '"col-md-6"', 'min' => self::MIN, 'max' => self::MAX, 'step' => '1', 'type' => 'number'));
$min = new Zend_Validate_LessThan(self::MAX + 1);
$max = new Zend_Validate_GreaterThan(self::MIN);
$input->addValidators(array(new Zend_Validate_Float(), $min, $max, new Zend_Validate_NotEmpty()));
$input->addDecorator($decoratorField);
$elements[] = $input;
//Add id hidden field
$input = new Zend_Form_Element_Hidden('product_id');
$min = new Zend_Validate_GreaterThan(self::MIN);
$input->addValidators(array(new Zend_Validate_Digits(), $min, new Zend_Validate_NotEmpty()));
$input->removeDecorator('HtmlTag');
$input->removeDecorator('Label');
$elements[] = $input;
$this->addElements($elements);
}
示例9: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', BASE_URL . 'veteranstatus/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'veteranstatus');
$id = new Zend_Form_Element_Hidden('id');
$veteranstatus = new Zend_Form_Element_Text('veteranstatus');
$veteranstatus->setAttrib('maxLength', 20);
$veteranstatus->setRequired(true);
$veteranstatus->addValidator('NotEmpty', false, array('messages' => 'Please enter veteran status.'));
$veteranstatus->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid veteran status.')))));
$veteranstatus->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_veteranstatus', 'field' => 'veteranstatus', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
$veteranstatus->getValidator('Db_NoRecordExists')->setMessage('Veteran status already exists.');
$description = new Zend_Form_Element_Textarea('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');
$url = "'gender/saveupdate/format/json'";
$dialogMsg = "''";
$toggleDivId = "''";
$jsFunction = "'redirecttocontroller(\\'gender\\');'";
$this->addElements(array($id, $veteranstatus, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例10: init
public function init()
{
$this->setMethod(Zend_Form::METHOD_POST);
$this->addDecorators(array("ViewHelper"), array("Errors"));
$firstname = new Zend_Form_Element_Text("first_name");
$firstname->setLabel("Firstname");
$firstname->setRequired(true);
$firstname->class = "span4";
$firstname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50))));
$lastname = new Zend_Form_Element_Text("last_name");
$lastname->setLabel("Lastname");
$lastname->setRequired(true);
$lastname->class = "span4";
$lastname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50))));
$email = new Zend_Form_Element_Text("email");
$email->setLabel("Email Address");
$email->setRequired(true);
$email->class = "span4";
$email->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(6, 50)));
$confirm_email = new Zend_Form_Element_Text("confirm_email");
$confirm_email->setLabel("Confirm Email Address");
$confirm_email->setRequired(true);
$confirm_email->class = "span4";
$confirm_email->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(6, 50)));
$this->addElements(array($firstname, $lastname, $email, $confirm_email));
}
示例11: __construct
public function __construct($minimumDeposit)
{
parent::__construct($minimumDeposit);
$savings_amount = new Zend_Form_Element_Text('savings_amount');
$savings_amount->addValidators(array(array('Float'), array('GreaterThan', false, array($minimumDeposit - 0.0001, 'messages' => array('notGreaterThan' => 'Minimum
Amount To open a savings account =' . $minimumDeposit)))));
$savings_amount->setAttrib('class', 'txt_put');
$savings_amount->setAttrib('id', 'amount');
$savings_amount->setRequired(true);
$savings_amount->setAttrib('onchange', 'calculateTotalAmount(this.value)');
$memberfirstname = new Zend_Form_Element_MultiCheckbox('memberfirstname');
$memberfirstname->setAttrib('class', 'textfield');
$memberfirstname->setAttrib('id', 'selector');
// $memberfirstname->setRequired(true);
$date1 = new ZendX_JQuery_Form_Element_DatePicker('date1', array('label' => 'Date:'));
$date1->setAttrib('class', 'txt_put');
$date1->setJQueryParam('dateFormat', 'yy-mm-dd');
$date1->setRequired(true);
$memberId = new Zend_Form_Element_Hidden('memberId');
$Type = new Zend_Form_Element_Hidden('Type');
$productId = new Zend_Form_Element_Hidden('productId');
$typeId = new Zend_Form_Element_Hidden('typeId');
$memberTypeIdv = new Zend_Form_Element_Hidden('memberTypeIdv');
$submit = new Zend_Form_Element_Submit('Submit');
$Yes = new Zend_Form_Element_Submit('Yes');
$back = new Zend_Form_Element_Submit('Back');
$this->addElements(array($submit, $savings_amount, $memberfirstname, $memberId, $date1, $productId, $typeId, $Type, $memberTypeIdv, $back, $Yes));
}
示例12: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'empsalarydetails');
$id = new Zend_Form_Element_Hidden('id');
$userid = new Zend_Form_Element_Hidden('user_id');
$currencyid = new Zend_Form_Element_Select('currencyid');
$currencyid->setLabel('Salary Currency');
$currencyid->setRegisterInArrayValidator(false);
$salarytype = new Zend_Form_Element_Select('salarytype');
$salarytype->setLabel("Pay Frequency");
$salarytype->setAttrib('id', 'jobpayfrequency');
//$salarytype->setAttrib('onchange', 'changesalarytext(this)');
$salarytype->setRegisterInArrayValidator(false);
/* $salarytype->setMultiOptions(array(
'' => 'Select Salary Type',
'1'=>'Yearly' ,
'2'=>'Hourly',
)); */
$salary = new Zend_Form_Element_Text('salary');
$salary->setLabel("Salary");
$salary->setAttrib('maxLength', 8);
$salary->addFilter(new Zend_Filter_StringTrim());
$salary->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')))));
$bankname = new Zend_Form_Element_Text('bankname');
$bankname->setAttrib('maxlength', 40);
$bankname->setLabel('Bank Name');
$bankname->addFilters(array('StringTrim'));
$bankname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\. ]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid bank name.')));
$accountholder_name = new Zend_Form_Element_Text('accountholder_name');
$accountholder_name->setAttrib('maxlength', 40);
$accountholder_name->setLabel('Account Holder Name');
$accountholder_name->addFilters(array('StringTrim'));
$accountholder_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')))));
$accountholding = new ZendX_JQuery_Form_Element_DatePicker('accountholding');
$accountholding->setLabel('Account Holding Since');
$accountholding->setAttrib('readonly', 'true');
$accountholding->setAttrib('onfocus', 'this.blur()');
$accountholding->setOptions(array('class' => 'brdr_none'));
$accountclasstypeid = new Zend_Form_Element_Select('accountclasstypeid');
$accountclasstypeid->setLabel('Account Class Type');
$accountclasstypeid->setRegisterInArrayValidator(false);
$bankaccountid = new Zend_Form_Element_Select('bankaccountid');
$bankaccountid->setLabel('Account Type');
$bankaccountid->setRegisterInArrayValidator(false);
$accountnumber = new Zend_Form_Element_Text('accountnumber');
$accountnumber->setAttrib('maxlength', 20);
$accountnumber->setLabel('Account Number');
$accountnumber->addFilters(array('StringTrim'));
$accountnumber->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ]*$/', 'messages' => array('regexNotMatch' => 'Please enter only alphanumeric characters.')));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $userid, $currencyid, $salarytype, $salary, $bankname, $accountholder_name, $accountholding, $accountclasstypeid, $bankaccountid, $accountnumber, $submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('accountholding'));
}
示例13: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'empjobhistory');
$id = new Zend_Form_Element_Hidden('id');
$userid = new Zend_Form_Element_Hidden('user_id');
$positionheld = new Zend_Form_Element_Select('positionheld');
$positionheld->setLabel('Position');
$positionheld->setRegisterInArrayValidator(false);
// $positionheld->setRequired(true);
// $positionheld->addValidator('NotEmpty', false, array('messages' => 'Please select position.'));
$department = new Zend_Form_Element_Select('department');
$department->setLabel('Department');
$department->setRegisterInArrayValidator(false);
// $department->setRequired(true);
// $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
$jobtitleid = new Zend_Form_Element_Select('jobtitleid');
$jobtitleid->setLabel('Job Title');
$jobtitleid->setRegisterInArrayValidator(false);
// $jobtitleid->setRequired(true);
// $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.'));
$start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date');
$start_date->setLabel('From');
$start_date->setOptions(array('class' => 'brdr_none'));
$start_date->setAttrib('readonly', 'true');
$start_date->setAttrib('onfocus', 'this.blur()');
$start_date->setRequired(true);
$start_date->addValidator('NotEmpty', false, array('messages' => 'Please enter start date.'));
$end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date');
$end_date->setLabel('To');
$end_date->setOptions(array('class' => 'brdr_none'));
$end_date->setAttrib('readonly', 'true');
$end_date->setAttrib('onfocus', 'this.blur()');
$received_amount = new Zend_Form_Element_Text("received_amount");
$received_amount->setLabel("Amount Received");
$received_amount->setAttrib('maxLength', 10);
$received_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')))));
$paid_amount = new Zend_Form_Element_Text("paid_amount");
$paid_amount->setLabel("Amount Paid");
$paid_amount->setAttrib('maxLength', 10);
$paid_amount->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9\\.]*$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')))));
$client = new Zend_Form_Element_Select('client');
$client->setLabel('Client');
$client->setRegisterInArrayValidator(false);
$client->setRequired(true);
$client->addValidator('NotEmpty', false, array('messages' => 'Please select a client.'));
$vendor = new Zend_Form_Element_Text("vendor");
$vendor->setLabel("Vendor");
$vendor->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.&\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid vendor name.')));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $userid, $positionheld, $jobtitleid, $department, $start_date, $end_date, $received_amount, $paid_amount, $client, $vendor, $submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date'));
}
示例14: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'educationdetails');
$this->setAttrib('action', DOMAIN . 'educationdetails/addpopup/');
$id = new Zend_Form_Element_Hidden('id');
$user_id = new Zend_Form_Element_Hidden('user_id');
$educationlevel = new Zend_Form_Element_Select('educationlevel');
$educationlevel->setLabel("Education Level");
$educationlevel->setRegisterInArrayValidator(false);
$educationlevel->setRequired(true);
$educationlevel->addValidator('NotEmpty', false, array('messages' => 'Please select educational level.'));
//institution_name ...
$institution_name = new Zend_Form_Element_Text('institution_name');
$institution_name->addFilter(new Zend_Filter_StringTrim());
$institution_name->setRequired(true);
$institution_name->setAttrib("maxlength", 50);
$institution_name->addValidator('NotEmpty', false, array('messages' => 'Please enter institution name.'));
$institution_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')))));
//course ...
$course = new Zend_Form_Element_Text('course');
$course->addFilter(new Zend_Filter_StringTrim());
$course->setRequired(true);
$course->setAttrib("maxlength", 50);
$course->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.'));
$course->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.')))));
//from_date..
$from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date');
$from_date->setOptions(array('class' => 'brdr_none'));
$from_date->setRequired(true);
$from_date->setAttrib('readonly', 'true');
$from_date->setAttrib('onfocus', 'this.blur()');
$from_date->addValidator('NotEmpty', false, array('messages' => 'Please select from date.'));
//to_date
$to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date');
$to_date->setOptions(array('class' => 'brdr_none'));
$to_date->setRequired(true);
$to_date->setAttrib('readonly', 'true');
$to_date->setAttrib('onfocus', 'this.blur()');
$to_date->addValidator('NotEmpty', false, array('messages' => 'Please select to date.'));
// percentage...
$percentage = new Zend_Form_Element_Text('percentage');
$percentage->addFilter(new Zend_Filter_StringTrim());
$percentage->setRequired(true);
$percentage->setAttrib("maxlength", 2);
$percentage->addValidator('NotEmpty', false, array('messages' => 'Please enter percentage.'));
$percentage->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.')));
//Form Submit....
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $user_id, $educationlevel, $from_date, $to_date, $percentage, $course, $institution_name, $submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('from_date', 'to_date'));
}
示例15: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'trainingandcertificationdetails');
$id = new Zend_Form_Element_Hidden('id');
$user_id = new Zend_Form_Element_Hidden('user_id');
//course_name ...
$course_name = new Zend_Form_Element_Text('course_name');
$course_name->addFilter(new Zend_Filter_StringTrim());
$course_name->setRequired(true);
$course_name->setAttrib('maxLength', 50);
$course_name->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.'));
$course_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.')))));
// course_level...
$course_level = new Zend_Form_Element_Text('course_level');
$course_level->addFilter(new Zend_Filter_StringTrim());
$course_level->setRequired(true);
$course_level->setAttrib('maxLength', 50);
$course_level->addValidator('NotEmpty', false, array('messages' => 'Please enter course level.'));
$course_level->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\.\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course level.')))));
//issued_date
$issued_date = new ZendX_JQuery_Form_Element_DatePicker('issued_date');
$issued_date->setOptions(array('class' => 'brdr_none'));
$issued_date->setAttrib('readonly', 'true');
$issued_date->setAttrib('onfocus', 'this.blur()');
// description ....
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
//course_offered_by ....
$course_offered_by = new Zend_Form_Element_Text('course_offered_by');
$course_offered_by->addFilter(new Zend_Filter_StringTrim());
$course_offered_by->setRequired(true);
$course_offered_by->setAttrib('maxLength', 50);
$course_offered_by->addValidator('NotEmpty', false, array('messages' => 'Please enter course offered by.'));
$course_offered_by->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid name.')))));
//Referer mobile number ....
$certification_name = new Zend_Form_Element_Text('certification_name');
$certification_name->addFilter(new Zend_Filter_StringTrim());
$certification_name->setAttrib('maxLength', 50);
$certification_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-z0-9\\-\\#\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid certification name.')))));
$certificationNameStr = Zend_Controller_Front::getInstance()->getRequest()->getParam('certification_name', null);
//If certification is done then should enter the issue date......
if ($certificationNameStr != "") {
$issued_date->setRequired(true);
$issued_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.'));
}
//Form Submit....
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $user_id, $certification_name, $course_offered_by, $description, $issued_date, $course_level, $course_name, $submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array('UiWidgetElement'), array('issued_date'));
}