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')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'holidaygroups'); $id = new Zend_Form_Element_Hidden('id'); $holidayname = new Zend_Form_Element_Text('holidayname'); $holidayname->setAttrib('maxLength', 20); $holidayname->addFilter(new Zend_Filter_StringTrim()); $holidayname->setRequired(true); $holidayname->addValidator('NotEmpty', false, array('messages' => 'Please enter holiday.')); $holidayname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid holiday.'))); $groupid = new Zend_Form_Element_Multiselect('groupid'); $groupid->setAttrib('class', 'selectoption'); $groupid->setRegisterInArrayValidator(false); $groupid->setRequired(true); $groupid->addValidator('NotEmpty', false, array('messages' => 'Please select holiday group.')); $holiday_date = new ZendX_JQuery_Form_Element_DatePicker('holidaydate'); $holiday_date->setAttrib('readonly', 'true'); $holiday_date->setAttrib('onfocus', 'this.blur()'); $holiday_date->setOptions(array('class' => 'brdr_none')); $holiday_date->setRequired(true); $holiday_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $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, $holidayname, $groupid, $holiday_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('holidaydate')); }
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')); }
public function init() { $this->setMethod('post'); $this->setAction(DOMAIN . 'index/editforgotpassword'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'forgotpassword'); $id = new Zend_Form_Element_Hidden('id'); $username = new Zend_Form_Element_Text('emailaddress'); $username->setAttrib('class', 'email-status'); $username->setLabel('Email Address:'); $username->setRequired(true); $username->addFilter('StripTags'); $username->addFilter('StringTrim'); $username->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $username->addValidator('EmailAddress'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('SEND'); $url = "'default/index/editforgotpassword/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "''"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $username, $submit)); $this->setElementDecorators(array('ViewHelper')); }
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')))); }
protected function _nome_caravana() { $e = new Zend_Form_Element_Text('nome_caravana'); $e->setLabel('* ' . _('Caravan name:')); $e->setRequired(true); $e->addValidator('Regex', false, array('/^(\\w|[áéíóúçãõ]|-|\\s)+$/')); $e->addValidator('StringLength', false, array(1, 100))->addErrorMessage(_("You enter a name too small (min. 1) or the name has invalid characters.")); $e->addFilter('StripTags'); $e->addFilter('StringTrim'); $e->setAttrib('class', 'form-control'); return $e; }
public function init() { $this->setMethod("POST"); $this->setName("createAdAgencyForm"); if (!empty($this->next)) { $element = new Zend_Form_Element_Hidden("next"); $element->setValue($this->next); $this->addElement($element); } $element = new Zend_Form_Element_Hidden(AdvertisingAgency::CITY); $element->setValue($this->city->id); $this->addElement($element); $element = new Zend_Form_Element_Text(User::NAME); $element->setLabel('怎么称呼您'); $element->setDescription('必填,中英文都可,2到30个字'); $this->addElement($element); $element = new Zend_Form_Element_Text(User::EMAIL); $element->setLabel('您的Email'); $element->setDescription('必填,方便我们联系您'); $element->setRequired(true); $element->addValidator(new Zend_Validate_EmailAddress()); $element->addValidator('NotEmpty'); $this->addElement($element); $element = new Zend_Form_Element_Text(User::MOBILE); $element->setLabel('您的手机号'); $element->addFilter(new Zend_Filter_HtmlEntities()); $element->addFilter(new Zend_Filter_StripTags()); $element->setDescription('方便我们及时联系您'); $this->addElement($element); $this->addDisplayGroup(array('city_id', 'name', 'email', 'mobile'), 'aboutYou'); $this->getDisplayGroup('aboutYou')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Textarea(AdvertisingAgency::DESCRIPTION); $element->setAttrib('rows', 6); $element->setLabel("有哪些人要入住?基本情况?尽量详细!"); $element->setDescription('如:三口之家,男30岁在爱立信有稳定工作,不吸烟;女27岁在kth读计算机硕士,不吸烟,男孩6岁。整洁,爱干净。'); $element->setRequired(true); $this->addElement($element); $element = new Zend_Form_Element_Textarea(AdvertisingAgency::COMMENT); $element->setAttrib('rows', 6); $element->setLabel("对房子的要求?最高房租?最小面积?地点?入住时间?"); $element->setDescription('如:最好是一室一厅的整个公寓,也可以与其他人合租。可以合用厨房卫生间。最高房租10000kr每月,最小面积30平米。地点只要是地铁附近,不要离中心太远都可以。入住时间是9月1日,希望能长租。'); $element->setRequired(true); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $element = new Zend_Form_Element_Submit("post"); $this->addElement($element); $this->addDisplayGroup(array(AdvertisingAgency::DESCRIPTION, AdvertisingAgency::COMMENT, 'challenge', 'post'), 'aboutRoom'); $this->getDisplayGroup('aboutRoom')->removeDecorator('DtDdWrapper'); }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml')))); $relativeDates = array(); $relativeDates[""] = ""; for ($i = 0; $i <= 30; $i++) { $relativeDates["{$i} days"] = "+{$i} " . _("days"); } for ($i = 1; $i <= 10; $i++) { $select = new Zend_Form_Element_Select("add_show_rebroadcast_date_{$i}"); $select->setAttrib('class', 'input_select'); $select->setMultiOptions($relativeDates); $select->setRequired(false); $select->setDecorators(array('ViewHelper')); $this->addElement($select); $text = new Zend_Form_Element_Text("add_show_rebroadcast_time_{$i}"); $text->setAttrib('class', 'input_text'); $text->addFilter('StringTrim'); $text->addValidator('date', false, array('HH:mm')); $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))); $text->setRequired(false); $text->setDecorators(array('ViewHelper')); $this->addElement($text); } }
public function init() { parent::init(); $this->setDecorators(array('PrepareElements', array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml')))); /* $instance = new Zend_Form_Element_Select("instance_id"); $instance->setLabel(_("Choose Show Instance")); $instance->setMultiOptions(array("0" => "-----------")); $instance->setValue(0); $instance->setDecorators(array('ViewHelper')); $this->addElement($instance); */ $starts = new Zend_Form_Element_Text(self::ID_PREFIX . 'starts'); $starts->setValidators(array(new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT))); $starts->setAttrib('class', self::TEXT_INPUT_CLASS . " datepicker"); $starts->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT); $starts->addFilter('StringTrim'); $starts->setLabel(_('Start Time')); $starts->setDecorators(array('ViewHelper')); $starts->setRequired(true); $this->addElement($starts); $ends = new Zend_Form_Element_Text(self::ID_PREFIX . 'ends'); $ends->setValidators(array(new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT))); $ends->setAttrib('class', self::TEXT_INPUT_CLASS . " datepicker"); $ends->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT); $ends->addFilter('StringTrim'); $ends->setLabel(_('End Time')); $ends->setDecorators(array('ViewHelper')); //$ends->setRequired(true); $this->addElement($ends); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'monthslist/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'monthslist'); $id = new Zend_Form_Element_Hidden('id'); $monthname = new Zend_Form_Element_Select('month_id'); $monthname->setAttrib('class', 'selectoption'); $monthname->setRegisterInArrayValidator(false); $monthname->setRequired(true); $monthname->addValidator('NotEmpty', false, array('messages' => 'Please select month name.')); $monthcode = new Zend_Form_Element_Text('monthcode'); $monthcode->setAttrib('maxLength', 20); $monthcode->addFilter(new Zend_Filter_StringTrim()); $monthcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_monthslist', 'field' => 'monthcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $monthcode->getValidator('Db_NoRecordExists')->setMessage('Month code 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 = "'monthslist/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'monthslist\\');'"; $this->addElements(array($id, $monthname, $monthcode, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function __construct($options = null) { parent::__construct($options); $emailCategoryOptionList = array('Invite non-sparks to join campaign' => $this->getView()->translate('Admin_Non-Sparks_Invitation'), 'Invite sparks to join campaign' => $this->getView()->translate('Admin_Sparks_Invitation'), 'Send mail to sparks' => $this->getView()->translate('Admin_Send_Mail_To_Sparks')); $emailCategory = new Zend_Form_Element_Select('emailCategory'); $emailCategory->setMultiOptions($emailCategoryOptionList); $emailList = new Zend_Form_Element_Textarea('emailList'); $emailList->setAttribs(array('rows' => 5, 'cols' => 150, 'onChange' => 'datetable()'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535)))); $subject = new Zend_Form_Element_Text('subject'); $subject->setAttribs(array('size' => 150))->addFilter('StringTrim'); $message = new Zend_Form_Element_Textarea('message'); $message->setAttribs(array('rows' => 30, 'cols' => 150))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535)))); $optionList = array(); $campaign = new Campaign(); $campaigns = $campaign->fetchAll(null, "id desc", null, null); foreach ($campaigns as $campaign) { $optionList[$campaign->id] = $campaign->name; } $optionList['0'] = $this->getView()->translate('ADMIN_NOT_AUTO_INVITATION'); $campaignId = new Zend_Form_Element_Select('campaignId'); $campaignId->setMultiOptions($optionList); $code_source = new Zend_Form_Element_Text('code_source'); $code_source->addFilter('StringTrim'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($this->getView()->translate('INVITATION_MAIL_SEND')); $this->addElements(array($emailCategory, $emailList, $subject, $message, $campaignId, $code_source, $submit)); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalratings'); // echo "ratings:".$appraisal_rating; die; $id = new Zend_Form_Element_Hidden('id'); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $rating_value = new Zend_Form_Element_Text("Rating Value"); //$rating_value->setAttrib('onchange', 'buildDiv(this)'); $rating_value->setLabel("Rating Value"); $rating_value->setAttrib('maxLength', 30); $rating_value->addFilter(new Zend_Filter_StringTrim()); $rating_value->setRequired(true); $rating_value->addValidator('NotEmpty', false, array('messages' => 'Please enter rating value.')); $rating_value->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid rating value.'))); $rating_text = new Zend_Form_Element_Text("Rating Text"); $rating_text->setLabel("Rating Text"); $rating_text->setAttrib('maxLength', 30); $rating_text->addFilter(new Zend_Filter_StringTrim()); $rating_text->setRequired(true); $rating_text->addValidator('NotEmpty', false, array('messages' => 'Please enter rating text.')); $rating_text->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid rating text.'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $rating_value, $rating_text, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'dashboard/viewprofile'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'profileview'); $id = new Zend_Form_Element_Hidden('id'); $userfullname = new Zend_Form_Element_Text("userfullname"); $userfullname->setLabel("User Name"); $userfullname->setAttrib("class", "formDataElement"); $userfullname->setAttrib('length', 70); $userfullname->setRequired(true); $userfullname->addValidator('NotEmpty', false, array('messages' => 'Please enter user name.')); $userfullname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $emailaddress = new Zend_Form_Element_Text('emailaddress'); $emailaddress->setRequired(true); $emailaddress->setAttrib('maxLength', 50); $emailaddress->setLabel("Email"); $emailaddress->addFilter('StripTags'); $emailaddress->addValidator('NotEmpty', false, array('messages' => 'Please enter email.')); $emailaddress->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.'))); $emailaddress->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_users', 'field' => 'emailaddress', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '"'))); $emailaddress->getValidator('Db_NoRecordExists')->setMessage('Email already exists.'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $userfullname, $emailaddress, $submit)); $this->setElementDecorators(array('ViewHelper')); }
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')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'militaryservice/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'militaryservice'); $id = new Zend_Form_Element_Hidden('id'); $militaryservicetype = new Zend_Form_Element_Text('militaryservicetype'); $militaryservicetype->setAttrib('maxLength', 20); $militaryservicetype->addFilter(new Zend_Filter_StringTrim()); $militaryservicetype->setRequired(true); $militaryservicetype->addValidator('NotEmpty', false, array('messages' => 'Please enter military service type.')); $militaryservicetype->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid military service type.'))))); $militaryservicetype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_militaryservice', 'field' => 'militaryservicetype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $militaryservicetype->getValidator('Db_NoRecordExists')->setMessage('Military service type 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, $militaryservicetype, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $username = new Zend_Form_Element_Text('name'); // $username = $this->createElement('text', 'name'); $username->setLabel('Username: *')->setRequired(true); //$username->addFilter(new Zend_Filter_HtmlEntities()); $username->addFilter(new Zend_Filter_StripTags()); $email = $this->createElement('text', 'email'); $email->setLabel('Email: *')->setRequired(false); $password = $this->createElement('password', 'password'); $password->setLabel('Password: *')->setRequired(true); $confirmPassword = $this->createElement('password', 'confirmPassword'); $confirmPassword->setLabel('Confirm Password: *')->setRequired(true); // $confirmPasswor = $this->createElement('text', 'image'); // $confirmPasswor->setLabel('Confirm image: *') // ->setRequired(false); $image = new Zend_Form_Element_File('image'); $image->setLabel("upload your iamge")->setDestination(APPLICATION_PATH . '/../public/data')->setRequired(true)->addValidator('Extension', false, array('jpg', 'jpeg', 'png'))->getValidator('Extension')->setMessage('This file type is not supportted.'); // $image->setDestination('/www/coff/data'); $this->setAttrib('enctype', 'multipart/form-data'); $room_no = $this->createElement('text', 'room_no'); $room_no->setLabel('Room number:')->setRequired(false); $ext = $this->createElement('text', 'ext'); $ext->setLabel('Ext:')->setRequired(false); $register = $this->createElement('submit', 'register'); $register->setLabel('Sign up')->setIgnore(true); $this->addElements(array($username, $email, $password, $confirmPassword, $image, $room_no, $ext, $register)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalcategory'); $id = new Zend_Form_Element_Hidden('id'); $appraisalcategory = new Zend_Form_Element_Text("category_name"); $appraisalcategory->setLabel('Parameter'); $appraisalcategory->setAttrib('maxLength', 30); $appraisalcategory->addFilter(new Zend_Filter_StringTrim()); $appraisalcategory->setRequired(true); $appraisalcategory->addValidator('NotEmpty', false, array('messages' => 'Please enter parameter.')); $appraisalcategory->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!+]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid parameter.'))); $appraisalcategory->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pa_category', 'field' => 'category_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); $appraisalcategory->getValidator('Db_NoRecordExists')->setMessage('Parameter name already exists.'); $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, $appraisalcategory, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { /* Form Elements & Other Definitions Here ... */ $element = new Zend_Form_Element_Text('login'); $element->setLabel('Login')->setRequired(); $validator = new Zend_Validate_NotEmpty(); $validator->setMessage('Le login est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY); $element->addValidator($validator); $validator = new Zend_Validate_StringLength(); $validator->setMax(40); $element->addValidator($validator); $filter = new Zend_Filter_StringTrim(); $element->addFilter($filter); $this->addElement($element); $element = new Zend_Form_Element_Password('password'); $element->setLabel('Mot de passe')->setRequired(); $validator = new Zend_Validate_NotEmpty(); $validator->setMessage('Le mot de passe est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY); $element->addValidator($validator); $validator = new Zend_Validate_StringLength(); $validator->setMax(40); $element->addValidator($validator); $filter = new Zend_Filter_StringTrim(); $element->addFilter($filter); $this->addElement($element); }
/** * @author code generate * @return mixed */ public function __construct($option = array()) { $classId = new Zend_Form_Element_Hidden('UserId'); $classId->setDecorators(array('ViewHelper')); $this->addElement($classId); $email = new Zend_Form_Element_Text('Email'); $email->setLabel('Email *'); $email->addFilter('StringTrim'); $email->setRequired(true); $email->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $email->addValidator(new Zend_Validate_Db_NoRecordExists("Users", "Email")); $email->addValidator('EmailAddress', true); $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp"))); $this->addElement($email); $save = new Zend_Form_Element_Submit('Save'); $save->setLabel('Đăng ký'); $save->setAttrib('class', 'btn btn-primary'); $save->setDecorators(array('ViewHelper')); $this->addElement($save); $reset = new Zend_Form_Element_Reset('Reset'); $reset->setLabel('Làm lại'); $reset->setAttrib('class', 'btn btn-primary'); $reset->setDecorators(array('ViewHelper')); $this->addElement($reset); }
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')); }
public function init() { $nome = new Zend_Form_Element_Text('nome', array('label' => 'Nome:', 'required' => true)); $val = new Zend_Validate_StringLength(array('min' => 10)); $nome->addValidator($val); $upper = new Zend_Filter_StringToUpper(); $nome->addFilter($upper); $this->addElement($nome); $email = new Zend_Form_Element_Text('email', array('label' => 'Email:')); $isEmail = new Zend_Validate_EmailAddress(); $email->addValidator($isEmail); $this->addElement($email); $senha = new Zend_Form_Element_Password('senha', array('label' => 'Senha:', 'required' => true)); $lenghtSenha = new Zend_Validate_StringLength(array('min' => 5, 'max' => 15)); $senha->addValidator($lenghtSenha); $this->addElement($senha); $endereco = new Zend_Form_Element_Text('endereco', array('label' => 'Endereço:')); $this->addElement($endereco); $bairro = new Zend_Form_Element_Text('bairro', array('label' => 'Bairro:')); $this->addElement($bairro); $cep = new Zend_Form_Element_Text('cep', array('label' => 'CEP:')); $this->addElement($cep); $pais = new Zend_Form_Element_Text('pais', array('label' => 'País:')); $this->addElement($pais); $botao = new Zend_Form_Element_Submit('botao', array('label' => 'Salvar')); $this->addElement($botao); }
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')); }
public function init() { $media_library_model = new Cms_Model_MediaLibraries(); $media_library = $media_library_model->getByPath($this->_attribs['media_library_path']); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title'); $title->setRequired(true); $title->addFilter('StringTrim'); $title->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $this->addElement($title); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Description'); $description->addFilter('StringTrim'); $description->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $this->addElement($description); $original = new Zend_Form_Element_File('original'); $original->addValidator('Count', false, 1); $original->addValidator('Extension', false, 'jpeg,jpg,png'); $original->addFilter('Rename', $this->_attribs['file_name']); $original->setDestination(My_Utilities::getUploadMediaPathDiffSizes($this->_attribs['file_name'], $this->_attribs['media_library_path'], 'original')); $original->setLabel('Image:'); $this->addElement($original); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Potvrdi'); $this->setAction('')->setMethod('post')->addElement($submit); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/cms/medias/index/library_id/" . $media_library->id . "'"); $this->addElement($cancel); }
public function init() { $this->setName('send-tweet'); $e = new Zend_Form_Element_Text('latitude'); $e->setLabel('Latitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Latitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Text('longitude'); $e->setLabel('Longitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Longitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Textarea('tweet'); $e->setLabel('Tweet'); $e->setRequired(true); $e->addFilter('StripTags'); $e->addFilter('StringTrim'); $e->addValidator(new Zend_Validate_StringLength(array('max' => 140))); $e->setTranslator(new Zend_Translate_Adapter_Array(array('isEmpty' => 'Please supply the message to be tweeted', 'stringLengthTooLong' => 'No more than 140 characters please!'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Submit('send'); $e->setIgnore(true); $e->setLabel('Tweet!'); $this->addElement($e); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'timeformat/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'timeformat'); $id = new Zend_Form_Element_Hidden('id'); $timeformat = new Zend_Form_Element_Text('timeformat'); $timeformat->setAttrib('maxLength', 20); $timeformat->addFilter(new Zend_Filter_StringTrim()); $timeformat->setRequired(true); $timeformat->addValidator('NotEmpty', false, array('messages' => 'Please enter time format.')); $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 = "'timeformat/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'timeformat\\');'"; $this->addElements(array($id, $timeformat, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicedeskdepartment'); $id = new Zend_Form_Element_Hidden('id'); $servicedeskdepartment = new Zend_Form_Element_Text("service_desk_name"); $servicedeskdepartment->setLabel("Category"); $servicedeskdepartment->setAttrib('maxLength', 30); $servicedeskdepartment->addFilter(new Zend_Filter_StringTrim()); $servicedeskdepartment->setRequired(true); $servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please enter category.')); $servicedeskdepartment->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid category.'))); $servicedeskdepartment->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_depts', 'field' => 'service_desk_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); $servicedeskdepartment->getValidator('Db_NoRecordExists')->setMessage('Category name already exists.'); $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, $servicedeskdepartment, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { /* Form Elements & Other Definitions Here ... */ // TODO setMethod $element = new Zend_Form_Element_Text('prenom'); $element->setLabel('Prénom')->setRequired(); $validator = new Zend_Validate_NotEmpty(); $validator->setMessage('Le prénom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY); $element->addValidator($validator); $validator = new Zend_Validate_StringLength(); $validator->setMax(40); $element->addValidator($validator); $filter = new Zend_Filter_StringTrim(); $element->addFilter($filter); $this->addElement($element); $element = new Zend_Form_Element_Text('nom'); $element->setLabel('Nom')->setRequired(); $validator = new Zend_Validate_NotEmpty(); $validator->setMessage('Le nom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY); $element->addValidator($validator); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('Email'); $this->addElement($element); $element = new Zend_Form_Element_Text('telephone'); $element->setLabel('Téléphone'); $this->addElement($element); }
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')); }
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')); }
public function init() { // salao_funcionamento_segunda_abertura $salao_funcionamento_segunda_abertura = new Zend_Form_Element_Text("salao_funcionamento_segunda_abertura"); $salao_funcionamento_segunda_abertura->setLabel("Abertura: "); $salao_funcionamento_segunda_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_segunda_abertura->setAttribs(array('class' => 'form-control')); $salao_funcionamento_segunda_abertura->addFilter(new Zend_Filter_Null()); // salao_funcionamento_segunda_fechamento $salao_funcionamento_segunda_fechamento = new Zend_Form_Element_Text("salao_funcionamento_segunda_fechamento"); $salao_funcionamento_segunda_fechamento->setLabel("Fechamento: "); $salao_funcionamento_segunda_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_segunda_fechamento->setAttribs(array('class' => 'form-control')); $salao_funcionamento_segunda_fechamento->addFilter(new Zend_Filter_Null()); // salao_funcionamento_abertura $salao_funcionamento_abertura = new Zend_Form_Element_Text("salao_funcionamento_abertura"); $salao_funcionamento_abertura->setLabel("Abertura: "); $salao_funcionamento_abertura->setRequired(); $salao_funcionamento_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_abertura->setAttribs(array('class' => 'form-control')); // salao_funcionamento_fechamento $salao_funcionamento_fechamento = new Zend_Form_Element_Text("salao_funcionamento_fechamento"); $salao_funcionamento_fechamento->setLabel("Fechamento: "); $salao_funcionamento_fechamento->setRequired(); $salao_funcionamento_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_fechamento->setAttribs(array('class' => 'form-control')); // salao_funcionamento_sabado_abertura $salao_funcionamento_sabado_abertura = new Zend_Form_Element_Text("salao_funcionamento_sabado_abertura"); $salao_funcionamento_sabado_abertura->setLabel("Fechamento: "); //$salao_funcionamento_sabado_abertura->setRequired(); $salao_funcionamento_sabado_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_sabado_abertura->setAttribs(array('class' => 'form-control')); $salao_funcionamento_sabado_abertura->addFilter(new Zend_Filter_Null()); // salao_funcionamento_sabado_fechamento $salao_funcionamento_sabado_fechamento = new Zend_Form_Element_Text("salao_funcionamento_sabado_fechamento"); $salao_funcionamento_sabado_fechamento->setLabel("Fechamento: "); //$salao_funcionamento_sabado_fechamento->setRequired(); $salao_funcionamento_sabado_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_sabado_fechamento->setAttribs(array('class' => 'form-control')); $salao_funcionamento_sabado_fechamento->addFilter(new Zend_Filter_Null()); // salao_funcionamento_domingo_abertura $salao_funcionamento_domingo_abertura = new Zend_Form_Element_Text("salao_funcionamento_domingo_abertura"); $salao_funcionamento_domingo_abertura->setLabel("Fechamento: "); //$salao_funcionamento_domingo_abertura->setRequired(); $salao_funcionamento_domingo_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_domingo_abertura->setAttribs(array('class' => 'form-control')); $salao_funcionamento_domingo_abertura->addFilter(new Zend_Filter_Null()); // salao_funcionamento_domingo_fechamento $salao_funcionamento_domingo_fechamento = new Zend_Form_Element_Text("salao_funcionamento_domingo_fechamento"); $salao_funcionamento_domingo_fechamento->setLabel("Fechamento: "); //$salao_funcionamento_domingo_fechamento->setRequired(); $salao_funcionamento_domingo_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_domingo_fechamento->setAttribs(array('class' => 'form-control')); $salao_funcionamento_domingo_fechamento->addFilter(new Zend_Filter_Null()); $this->addElement('hidden', 'salao_id', array('value' => Zend_Auth::getInstance()->getIdentity()->salao_id)); $this->addElements(array($salao_funcionamento_segunda_abertura, $salao_funcionamento_segunda_fechamento, $salao_funcionamento_abertura, $salao_funcionamento_fechamento, $salao_funcionamento_sabado_abertura, $salao_funcionamento_sabado_fechamento, $salao_funcionamento_domingo_abertura, $salao_funcionamento_domingo_fechamento)); parent::init(); }