Beispiel #1
1
 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'));
 }
Beispiel #2
0
 /** Initialize this form. */
 public function init()
 {
     $this->setName('oai_admin');
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('YTVEA8QwsJqFaPfcnEugjKrM');
     $csrf->setDecorators(array('ViewHelper'));
     $repositoryName = new Zend_Form_Element_Text(OAI_REPOSITORY_NAME_KEY);
     $repositoryName->setLabel('OAI Repository Name');
     $repositoryName->setRequired(true);
     $repositoryName->addValidator('NotEmpty', true);
     $repositoryIdentifier = new Zend_Form_Element_Text(OAI_REPOSITORY_IDENTIFIER_KEY);
     $repositoryIdentifier->setLabel('OAI Repository Identifier');
     $repositoryIdentifier->setRequired(true);
     $repositoryIdentifier->addValidator('NotEmpty', true);
     $adminEmail = new Zend_Form_Element_Text(OAI_ADMIN_EMAIL_KEY);
     $adminEmail->setLabel('Admin Email Address');
     $adminEmail->setRequired(true);
     $adminEmail->addValidator('NotEmpty', true);
     $adminEmail->addValidator('EmailAddress', true);
     $this->addDisplayGroup(array($repositoryName, $repositoryIdentifier, $adminEmail), 'global');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $repositoryName, $repositoryIdentifier, $adminEmail, $submit));
 }
Beispiel #3
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'emailcontacts');
     $this->setAttrib('action', BASE_URL . 'emailcontacts/add/');
     $id = new Zend_Form_Element_Hidden('id');
     $group_id = new Zend_Form_Element_Select("group_id");
     $group_id->setRegisterInArrayValidator(false);
     $group_id->setRequired(true);
     $group_id->addValidator('NotEmpty', false, array('messages' => 'Please select group.'));
     $business_unit_id = new Zend_Form_Element_Select("business_unit_id");
     $business_unit_id->setRegisterInArrayValidator(false);
     $business_unit_id->setRequired(true);
     $business_unit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $business_unit_id->setAttrib('onchange', "bunit_emailcontacts('business_unit_id');");
     //Group Email....
     $grpEmail = new Zend_Form_Element_Text('groupEmail');
     $grpEmail->addFilters(array('StringTrim', 'StripTags'));
     $grpEmail->setRequired(true);
     $grpEmail->addValidator('NotEmpty', false, array('messages' => 'Please enter group email.'));
     $grpEmail->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.')));
     $grpEmail->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_emailcontacts', 'field' => 'groupEmail', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
     $grpEmail->getValidator('Db_NoRecordExists')->setMessage('Group email already exists.');
     // Form Submit .........
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $group_id, $grpEmail, $submit, $business_unit_id));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #4
0
 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'));
 }
Beispiel #5
0
 /**
  * @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);
 }
Beispiel #6
0
 public function init()
 {
     $this->setName('registerForm');
     $this->setMethod('post');
     $this->setAction('/user/register/');
     $user = new Zend_Form_Element_Text('user');
     $user->setLabel('Username');
     $user->setRequired(true);
     $user->addValidator('Alnum', false);
     $user->addValidator('StringLength', true, array(3, 30));
     //$user->addValidator('Db_NoRecordExists', true, array('user', 'user') );
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password');
     $password->setRenderPassword(true);
     $password->setRequired(true);
     $password->addValidator('StringLength', true, array(5, 50));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Full Name');
     $name->setRequired(true);
     $name->addValidator('StringLength', true, array(3, 128));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email');
     $email->setRequired(true);
     $email->addValidator('EmailAddress', true);
     $email->addValidator('StringLength', true, array(3, 128));
     $submit = new Zend_Form_Element_Submit('register');
     $submit->setLabel('Register');
     $hash = new Zend_Form_Element_Hash('hash');
     $this->setElements(array($user, $password, $name, $email, $submit, $hash));
 }
Beispiel #7
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'payfrequency/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'payfrequency');
     $id = new Zend_Form_Element_Hidden('id');
     $freqtype = new Zend_Form_Element_Text('freqtype');
     $freqtype->setAttrib('maxLength', 20);
     $freqtype->setLabel("Pay Frequency");
     $freqtype->setRequired(true);
     $freqtype->addValidator('NotEmpty', false, array('messages' => 'Please enter pay frequency type.'));
     $freqtype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid pay frequency type.')));
     $freqtype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_payfrequency', 'field' => 'freqtype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $freqtype->getValidator('Db_NoRecordExists')->setMessage('Pay frequency type already exists.');
     $freqshortcode = new Zend_Form_Element_Text('freqcode');
     $freqshortcode->setLabel("Short Code");
     $freqshortcode->setAttrib('maxLength', 20);
     $freqshortcode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid pay frequency short code.')));
     $freqshortcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_payfrequency', 'field' => 'freqcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $freqshortcode->getValidator('Db_NoRecordExists')->setMessage('Pay frequency short code already exists.');
     $description = new Zend_Form_Element_Textarea('freqdescription');
     $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, $freqtype, $freqshortcode, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #8
0
 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'));
 }
Beispiel #9
0
 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;');
     // Producto
     $e = new Zend_Form_Element_Select('id_producto');
     $e->setLabel('Producto');
     $e->setRequired();
     $_producto = new Application_Model_Producto();
     $e->addMultiOption(-1, '--Producto--');
     $e->addMultiOptions($_producto->getComboValues());
     $e->addValidator(new Zend_Validate_InArray($_producto->getComboValidValues()));
     $this->addElement($e);
     // Cantidad
     $e = new Zend_Form_Element_Text('cantidad');
     $e->setLabel('Cantidad');
     $e->setRequired();
     $e->addValidator(new Zend_Validate_Int(new Zend_Locale('US')));
     $e->addValidator(new Zend_Validate_GreaterThan(0));
     $e->addValidator(new Zend_Validate_LessThan(100));
     $this->addElement($e);
     // AddVentaDetalles
     $e = new Zend_Form_Element_Hidden('is_detalle');
     $e->setValue(true);
     $e->setRequired();
     $this->addElement($e);
     //Submit
     $e = new Zend_Form_Element_Submit('submit');
     $e->setLabel('Agregar');
     $this->addElement($e);
 }
Beispiel #10
0
 /** Initialize this form. */
 public function init()
 {
     $this->setName('sizequota_admin');
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('f6g5NzqPWAunkSykbBpmTmpH');
     $csrf->setDecorators(array('ViewHelper'));
     $defaultUserQuotaValue = new Zend_Form_Element_Text(MIDAS_SIZEQUOTA_DEFAULT_USER_QUOTA_VALUE_KEY);
     $defaultUserQuotaValue->setLabel('Default User Quota');
     $defaultUserQuotaValue->addValidator('Float', true);
     $defaultUserQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $defaultUserQuotaUnit = new Zend_Form_Element_Select(MIDAS_SIZEQUOTA_DEFAULT_USER_QUOTA_UNIT_KEY);
     $defaultUserQuotaUnit->setLabel('Unit');
     $defaultUserQuotaUnit->setRequired(true);
     $defaultUserQuotaUnit->addValidator('NotEmpty', true);
     $defaultUserQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($defaultUserQuotaValue, $defaultUserQuotaUnit), 'default_user_quota');
     $defaultCommunityQuotaValue = new Zend_Form_Element_Text(MIDAS_SIZEQUOTA_DEFAULT_COMMUNITY_QUOTA_VALUE_KEY);
     $defaultCommunityQuotaValue->setLabel('Default Community Quota');
     $defaultCommunityQuotaValue->addValidator('Float', true);
     $defaultCommunityQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $defaultCommunityQuotaUnit = new Zend_Form_Element_Select(MIDAS_SIZEQUOTA_DEFAULT_COMMUNITY_QUOTA_UNIT_KEY);
     $defaultCommunityQuotaUnit->setLabel('Unit');
     $defaultCommunityQuotaUnit->setRequired(true);
     $defaultCommunityQuotaUnit->addValidator('NotEmpty', true);
     $defaultCommunityQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($defaultCommunityQuotaValue, $defaultCommunityQuotaUnit), 'default_community_quota');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $defaultUserQuotaValue, $defaultUserQuotaUnit, $defaultCommunityQuotaValue, $defaultCommunityQuotaUnit, $submit));
 }
Beispiel #11
0
 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'));
 }
Beispiel #12
0
 /**
  * Creates the form to log in.
  * @see Zend_Form::init()
  */
 public function init()
 {
     $this->setMethod('post');
     $this->setAction("/auth/login/");
     $usernameElement = new Zend_Form_Element_Text('username');
     $usernameElement->setLabel("Benutzername");
     $usernameElement->addValidator('regex', false, array('/^[a-z0-9]/i'));
     $usernameElement->addValidator('stringLength', false, array(2, 64));
     $usernameElement->setAttrib('maxLength', 64);
     $usernameElement->setRequired(true);
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setLabel("Passwort");
     $passwordElement->addValidator('regex', false, array('/^[a-z0-9]/i'));
     $passwordElement->addValidator('stringLength', false, array(8, 32));
     $passwordElement->setAttrib('maxLength', 32);
     $passwordElement->setRequired(true);
     $submitElement = new Zend_Form_Element_Submit('submit');
     $submitElement->setLabel('Anmelden');
     $submitElement->setIgnore(true);
     $submitElement->setAttrib('class', 'submit');
     $submitElement->removeDecorator('DtDdWrapper');
     $this->addElements(array($usernameElement, $passwordElement));
     $this->addDisplayGroup(array('username', 'password'), 'credentialGroup', array('legend' => 'Zugangsdaten'));
     $this->addElements(array($submitElement));
 }
Beispiel #13
0
 /** Initialize this form. */
 public function init()
 {
     $this->setName('sizequota_folder');
     $this->setAction($this->getView()->baseUrl('/sizequota/folder/submit'));
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('FDXuUnSDkUE7Anh2kqgca8zv');
     $csrf->setDecorators(array('ViewHelper'));
     $folderId = new Zend_Form_Element_Hidden('folder_id');
     $folderId->setDecorators(array('ViewHelper'));
     $useDefaultFolderQuota = new Zend_Form_Element_Checkbox('use_default_folder_quota');
     $useDefaultFolderQuota->setLabel('Use Default Folder Quota');
     $folderQuotaValue = new Zend_Form_Element_Text('folder_quota_value');
     $folderQuotaValue->setLabel('Quota');
     $folderQuotaValue->addValidator('Float', true);
     $folderQuotaValue->addValidator('Between', true, array('min' => 0, 'max' => PHP_INT_MAX));
     $folderQuotaUnit = new Zend_Form_Element_Select('folder_quota_unit');
     $folderQuotaUnit->setLabel('Unit');
     $folderQuotaUnit->setRequired(true);
     $folderQuotaUnit->addValidator('NotEmpty', true);
     $folderQuotaUnit->addMultiOptions(array(MIDAS_SIZE_B => 'B', MIDAS_SIZE_KB => 'KB', MIDAS_SIZE_MB => 'MB', MIDAS_SIZE_GB => 'GB', MIDAS_SIZE_TB => 'TB'));
     $this->addDisplayGroup(array($useDefaultFolderQuota, $folderQuotaValue, $folderQuotaUnit), 'global');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $folderId, $useDefaultFolderQuota, $folderQuotaValue, $folderQuotaUnit, $submit));
 }
Beispiel #14
0
 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'))));
 }
 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);
     }
 }
Beispiel #16
0
 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'));
 }
 function __construct($user)
 {
     parent::__construct();
     $this->setName('Registration');
     $this->setMethod('POST');
     $this->setAction('/user/update');
     $gender = new Zend_Form_Element_Select('gender');
     $gender->setLabel('Gender');
     $gender->setMultiOptions(array('Male' => 'Male', 'Female' => 'Female'));
     $gender->setValue($user->gender);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email');
     $email->setValue($user->email);
     $email->setRequired(true);
     $email->addValidator('NotEmpty', true);
     $email->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $paymentEmail = new Zend_Form_Element_Text('paymentEmail');
     $paymentEmail->setLabel('Payment Email');
     $paymentEmail->setRequired(true);
     $paymentEmail->addValidator('NotEmpty', true);
     $paymentEmail->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $paymentEmail->setValue($user->paymentEmail);
     $countries = new Zend_Form_Element_Select('country');
     $countries->setMultiOptions(self::getCountries());
     $countries->setLabel('Country');
     $countries->addValidator('NotEmpty');
     $countries->setValue($user->country);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Update');
     $this->addElements(array($gender, $email, $paymentEmail, $countries, $submit));
 }
Beispiel #18
0
 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'));
 }
Beispiel #19
0
 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()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oBBarcode = new Zend_Form_Element_Text("bbarcode_id");
     $oBBarcode->setLabel("Numer karty bibliotecznej:")->setFilters($this->_aFilters);
     $oBBarcode->addValidator(new AppCms2_Validate_BBarcode());
     $oBBarcode->addValidator(new Zend_Validate_Digits());
     $oBBarcode->setRequired(TRUE);
     $oBBarcode->setAttrib("class", "valid");
     $this->addElement($oBBarcode);
     $oSubmit = new Zend_Form_Element_Submit("submit_get_sybase_user_param");
     $oSubmit->setLabel("Pobierz");
     $this->addElement($oSubmit);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
Beispiel #21
0
 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 . 'attendancestatuscode/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'attendancestatuscode');
     $id = new Zend_Form_Element_Hidden('id');
     $attendancestatuscode = new Zend_Form_Element_Text('attendancestatuscode');
     $attendancestatuscode->setAttrib('maxLength', 20);
     //$attendancestatuscode->addFilter(new Zend_Filter_StringTrim());
     $attendancestatuscode->setRequired(true);
     $attendancestatuscode->addValidator('NotEmpty', false, array('messages' => 'Please enter attendance status.'));
     $attendancestatuscode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid attendance status.')));
     $attendancestatuscode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_attendancestatuscode', 'field' => 'attendancestatuscode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $attendancestatuscode->getValidator('Db_NoRecordExists')->setMessage('Attendance 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');
     $this->addElements(array($id, $attendancestatuscode, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'workeligibilitydoctypes/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'workeligibilitydoctypes');
     $id = new Zend_Form_Element_Hidden('id');
     $documenttype = new Zend_Form_Element_Text('documenttype');
     $documenttype->setAttrib('maxLength', 50);
     $documenttype->setRequired(true);
     $documenttype->addValidator('NotEmpty', false, array('messages' => 'Please enter document type.'));
     $documenttype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document type.')));
     $documenttype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_workeligibilitydoctypes', 'field' => 'documenttype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1')));
     $documenttype->getValidator('Db_NoRecordExists')->setMessage('Document type already exists.');
     $issuingauthority = new Zend_Form_Element_Select('issuingauthority');
     $issuingauthority->setRegisterInArrayValidator(false);
     $issuingauthority->setMultiOptions(array('' => 'Select issuing authority', '1' => 'Country', '2' => 'State', '3' => 'City'));
     $issuingauthority->setRequired(true);
     $issuingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select issuing authority.'));
     $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, $documenttype, $issuingauthority, $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);
 }
 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()
 {
     $this->setMethod('POST');
     $this->setName('guestForm');
     $element = new Zend_Form_Element_Text('name');
     $element->setLabel('怎么称呼您');
     $element->setDescription('必填,中英文都可,2到30个字');
     $element->setRequired(true);
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('您的Email');
     $element->setRequired(true);
     $element->addValidator(new Zend_Validate_EmailAddress());
     $element->addValidator('NotEmpty');
     $element->setDescription('必填');
     $this->addElement($element);
     $element = new Zend_Form_Element_Textarea('body');
     $element->setLabel('您的留言');
     $element->setAttrib('rows', 4);
     $element->addValidator('NotEmpty');
     $this->addElement($element);
     $element = new Elements();
     $element->addReCaptcha($this);
     $element = new Zend_Form_Element_Submit('post');
     $element->setValue('提交')->removeDecorator('Label');
     $this->addElement($element);
 }
Beispiel #27
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'employmentstatus/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'employmentstatus');
     $id = new Zend_Form_Element_Hidden('id');
     $workcode = new Zend_Form_Element_Text('workcode');
     $workcode->setAttrib('maxLength', 20);
     $workcode->setRequired(true);
     $workcode->addValidator('NotEmpty', false, array('messages' => 'Please enter work short code.'));
     $workcode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid work short code.')));
     $workcodename = new Zend_Form_Element_Select('workcodename');
     $workcodename->setAttrib('class', 'selectoption');
     $workcodename->setRegisterInArrayValidator(false);
     $workcodename->setRequired(true);
     $workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select work code.'));
     $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, $workcode, $workcodename, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Beispiel #28
0
 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'));
 }
Beispiel #29
0
 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'));
 }
Beispiel #30
0
 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmRegistrar');
     $e = new Zend_Form_Element_Text('nombre');
     $e->setRequired();
     $e->setLabel('Nombre');
     $e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 25)));
     $e->addValidator(new My_Validate_NoX());
     $e->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'usuario', 'field' => 'nombre')));
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('login');
     $e->setRequired();
     $e->setLabel('Login');
     $e->addValidator(new Zend_Validate_Alnum());
     $e->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'usuario', 'field' => 'login')));
     $e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 25)));
     $this->addElement($e);
     $e = new Zend_Form_Element_Password('pwd');
     $e->setRequired();
     $e->setLabel('Password');
     $this->addElement($e);
     $e = new Zend_Form_Element_Password('pwd_2');
     $e->setRequired();
     $e->setLabel('Confirmación Password');
     $e->addValidator(new My_Validate_PasswordConfirmation());
     $this->addElement($e);
     $this->addElement('submit', 'Enviar');
 }