/** * Initializing form */ public function init() { parent::init(); $element = new Zend_Form_Element_Select('year'); $element->setLabel('Jaar')->addMultiOption('', '...')->setDescription('Percentages zijn van toepassing op dit jaartal')->setRequired(true); $entries = Model_Hm_Week_Percentage::findAllByHomeId($this->getHomeId())->select('wp.year, wp.id, wp.hm_home_id')->execute(null, Doctrine_Core::HYDRATE_ARRAY); $availableYears = new Model_Hm_AvailableYears($entries); foreach ($availableYears->toArray() as $year) { $element->addMultiOption($year, $year); } $this->addElement($element); $this->addDisplayGroup(array('year'), 'year-group', array('legend' => 'Algemeen', 'class' => 'width100')); for ($weekNo = 01; $weekNo <= 53; $weekNo++) { $elementName = 'week_' . $weekNo; $elements[] = $elementName; $element = new Zend_Form_Element_Text($elementName); $element->setLabel('Percentage')->setValidators(array(array('Float')))->setAttribs(array('maxlength' => 6))->setRequired(true); $this->addElement($element); $this->addDisplayGroup(array($elementName), $elementName . 'group', array('class' => 'weekpercentage', 'legend' => 'Week ' . $weekNo)); } $element = new Zend_Form_Element_Submit('submit_percentageweek'); $element->setLabel('Verwerken')->setAttrib('class', 'submit'); $this->addElement($element); $this->addDisplayGroup(array('submit_percentageweek'), 'submit', array('class' => 'submit')); $this->bhvkDecorators(); $this->bhvkDecorateSubmitElement($this->getElement('submit_percentageweek')); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $finds = new Findspots(); $schema = $finds->info(); $fields = array_flip($schema['cols']); $remove = array('updated', 'created', 'updatedBy', 'createdBy', 'institution', 'findID', 'address', 'fourFigure', 'gridlen', 'postcode', 'easting', 'northing', 'declong', 'declat', 'fourFigureLat', 'fourFigureLon', 'woeid', 'geonamesID', 'osmNode', 'elevation', 'geohash', 'country', 'map25k', 'map10k', 'soiltype', 'smrref', 'otherref', 'id', 'accuracy', 'secuid', 'old_occupierid', 'occupier', 'old_findspotid', 'date'); foreach ($remove as $rem) { unset($fields[$rem]); } $labels = array('gridrefcert' => 'Grid reference certainty', 'gridref' => 'Grid reference', 'knownas' => 'Known as', 'disccircum' => 'Discovery circumstances', 'gridrefsrc' => 'Grid reference source', 'landusevalue' => 'Land use value', 'landusecode' => 'Land use code', 'depthdiscovery' => 'Depth of discovery', 'Highsensitivity' => 'High sensitivity'); parent::__construct($options); $this->setName('configureFindSpotCopy'); $elements = array(); foreach (array_keys($fields) as $field) { $label = $field; $field = new Zend_Form_Element_Checkbox($field); if (array_key_exists($label, $labels)) { $clean = ucfirst($labels[$label]); } else { $clean = ucfirst($label); } $field->setLabel($clean)->setRequired(false)->addValidator('NotEmpty', 'boolean'); $elements[] = $field; $this->addElement($field); } $this->addDisplayGroup($elements, 'details'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit find spot configuration'); $this->addElement($submit); $this->details->setLegend('Choose fields: '); parent::init(); }
public function init() { $languageFile = Zend_Registry::get('languageFile'); $translate = new Zend_Translate('array', $languageFile, 'zh_CN'); $this->setTranslator($translate); $this->setMethod('POST'); $this->setName('contactForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); //$element->setRequired(true); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $this->addDisplayGroup(array('name', 'email', 'captcha'), 'leftSection'); $this->getDisplayGroup('leftSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Textarea('body'); $element->setLabel('想要开通城市地区和找房贴士,关于您的简单介绍'); $element->addPrefixPath('My_Validator', 'My/Validator/', 'validate'); $element->addValidator('FormValueNotNull', true); //$element->setRequired(true); $element->setAttrib('rows', 13); $this->addElement($element); $this->addDisplayGroup(array('body'), 'rightSection'); $this->getDisplayGroup('rightSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Submit('post'); $element->removeDecorator('Label'); $this->addElement($element); }
public function __construct($parent = null, $options = null) { parent::__construct($options); $parentId = 0; if ($parent != null) { $parentId = $parent; } $translate = Zend_Registry::get('Zend_Translate'); $this->setName('comment_form'); $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator'); /* $comment_subject = new Zend_Form_Element_Text('comment_subject'); $comment_subject->setLabel($translate->_("content-view-comment-form-subject")) ->setRequired(true) ->setAttribs(array( 'class' => 'comment_subject')) ->addValidators(array( array('NotEmpty', true, array('messages' => array('isEmpty' => 'Tyhjä'))) )); */ $comment_message = new Zend_Form_Element_Textarea('comment_message'); $comment_message->setRequired(true)->setAttribs(array('rows' => 10, 'cols' => 58, 'class' => 'comment_textarea'))->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Tyhjä'))))); $comment_parent = new Zend_Form_Element_Hidden('comment_parent'); $comment_parent->setValue($parentId)->setAttribs(array('class' => 'comment_subject')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($translate->_("submit")); $parent_username = new Zend_Form_Element_Hidden('parent_username'); $this->addElements(array($comment_message, $comment_parent, $submit, $parent_username)); }
public function __construct(array $dataBusinessId, $options = null) { parent::__construct($options); $this->setName('frmEmployee'); $this->setMethod('post'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Employee name'); $name->setAttrib('maxlength', 80); $name->setRequired(true); $name->addValidator(new Zend_Validate_NotEmpty()); $this->addElement($name); $age = new Zend_Form_Element_Text('age'); $age->setLabel('Employee age'); $age->addValidator(new Zend_Validate_Int()); $this->addElement($age); $businessId = new Zend_Form_Element_Select('business_id'); $businessId->setLabel('Business'); $businessId->setRequired(true); $businessId->addValidator(new Zend_Validate_NotEmpty()); $businessId->addValidator(new Zend_Validate_Int()); $businessId->addMultiOptions($dataBusinessId); $this->addElement($businessId); $submit = new Zend_Form_Element_Submit('bt_submit'); $submit->setLabel('Save'); $this->addElement($submit); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $noi_dung = new Zend_Form_Element_Textarea('noi_dung'); $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea')); $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed'); $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $youtube_embed = new Zend_Form_Element_Text('youtube_embed'); $youtube_embed->setLabel('Embed Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $link_nct = new Zend_Form_Element_Text('link_nct'); $link_nct->setLabel('Nhac cua tui')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $link_mp3 = new Zend_Form_Element_Text('link_mp3'); $link_mp3->setLabel('Mp3')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_giang')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"')); $this->addElements(array($tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $link_nct, $link_mp3, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
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() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $quan_trong = new Zend_Form_Element_Select('quan_trong'); $quan_trong->setLabel('Quan Trọng')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $image = new Zend_Form_Element_Image('image'); $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $mo_ta_tom_tat = new Zend_Form_Element_Textarea('mo_ta_tom_tat'); $mo_ta_tom_tat->setLabel('Mô tả tóm tắt')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_tom_tat', 'class' => 'textarea', 'rows' => '4')); $mo_ta_chi_tiet = new Zend_Form_Element_Textarea('mo_ta_chi_tiet'); $mo_ta_chi_tiet->setLabel('Mô tả chi tiết (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_chi_tiet', 'class' => 'text-input textarea')); $pdf = new Zend_Form_Element_File('pdf'); $pdf->setLabel('Upload PDF')->setDescription('(*.pdf < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'tin-tuc', 'action' => 'index'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($tieu_de, $quan_trong, $noi_bat, $photo, $image, $pdf, $trang_thai, $mo_ta_tom_tat, $mo_ta_chi_tiet, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'tin_tuc')), 'Form')); }
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() { $country_code = new Zend_Form_Element_Text('country_code'); $country_code->setLabel('Country code'); $country_code->setDescription('List of codes you can see here: http://framework.zend.com/manual/1.12/en/zend.locale.appendix.html'); $country_code->setRequired(true); $this->addElement($country_code); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $is_active = new Zend_Form_Element_Checkbox('is_active'); $is_active->setLabel('Active'); $is_active->setRequired(true); $this->addElement($is_active); $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+'/locale/languages/'"); $this->addElement($cancel); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($submit); }
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 __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->setName('applog'); $id = new Zend_Form_Element_Hidden('id'); $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $timestamp = new Zend_Form_Element_Text('timestamp'); $timestamp->setLabel('timestamp'); $priorityName = new Zend_Form_Element_Text('priorityName'); $priorityName->setLabel('priorityName'); $priority = new Zend_Form_Element_Text('priority'); $priority->setLabel('priority'); $className = new Zend_Form_Element_Text('className'); $className->setLabel('className'); $message = new Zend_Form_Element_Textarea('message'); $message->setLabel('message'); $identity = new Zend_Form_Element_Text('identity'); $identity->setLabel('identity'); $httpReferer = new Zend_Form_Element_Textarea('HTTP_REFERER'); $httpReferer->setLabel('HTTP_REFERER'); $remoteAddr = new Zend_Form_Element_Text('REMOTE_ADDR'); $remoteAddr->setLabel('REMOTE_ADDR'); $requestMethod = new Zend_Form_Element_Text('REQUEST_METHOD'); $requestMethod->setLabel('REQUEST_METHOD'); $requestTime = new Zend_Form_Element_Text('REQUEST_TIME'); $requestTime->setLabel('REQUEST_TIME'); $mysqltimestamp = new Zend_Form_Element_Text('mysqltimestamp'); $mysqltimestamp->setLabel('mysqltimestamp'); $elements = array($id, $hash, $timestamp, $priorityName, $priority, $className, $message, $identity, $httpReferer, $remoteAddr, $requestMethod, $requestTime, $mysqltimestamp); $this->addElements($elements); $this->addElements(array($submit)); }
function editUserPassword() { $this->setMethod('post'); $this->addAttribs(array('id' => 'formAccountEditPassword', 'class' => '')); $filters = array(new Zend_Filter_StringTrim(), new Zend_Filter_StripTags()); $control = new Zend_Form_Element_Hidden('control'); $control->setValue('editPassword'); $this->addElement($control); $oldPassword = new Zend_Form_Element_Password('oldPassword'); $oldPassword->setLabel('Old password'); $oldPassword->addValidator(new Zend_Validate_StringLength(6, 32)); $oldPassword->setAttribs(array('class' => 'text validate[required,minSize[6],maxSize[32]] rightAdd', 'minlenght' => '6', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'data-prompt-position' => 'topLeft:0')); $oldPassword->setRequired(true); $this->addElement($oldPassword); $password = new Zend_Form_Element_Password('password'); $password->setLabel(Zend_Registry::get('translate')->_('admin_administrators_new_password')); $password->addValidator(new Zend_Validate_StringLength(6, 32)); $password->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false')); $password->setRequired(true); $this->addElement($password); $retypePassword = new Zend_Form_Element_Password('retypePassword'); $retypePassword->setLabel(Zend_Registry::get('translate')->_('admin_administrators_retype_new_password')); $retypePassword->addValidator(new Zend_Validate_Identical('password')); $retypePassword->addValidator(new Zend_Validate_StringLength(6, 32)); $retypePassword->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false')); $retypePassword->setRequired(true); $retypePassword->setIgnore(true); $this->addElement($retypePassword); $submit = new Zend_Form_Element_Submit('savePassword'); $submit->setValue(Zend_Registry::get('translate')->_('apply_password')); $submit->setAttribs(array('class' => 'submit tsSubmitLogin fL')); $submit->setIgnore(true); $this->addElement($submit); $this->setElementFilters($filters); }
public function __construct($options = null) { parent::__construct(); $this->setName('layout_form'); $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator'); $this->removeDecorator('Errors'); $this->removeDecorator('HtmlTag'); $this->removeDecorator('Label'); //$this->setAction($this->_generateActionUrl()); $layout_select = new Zend_Form_Element_Select('layout_select'); $layout_select->setAttrib('onchange', '$("#submitLayoutSelection").click();'); $layout_select->removeDecorator('Errors'); $layout_select->removeDecorator('Label'); $layout_select->removeDecorator('HtmlTag'); /*foreach($options as $language) $translation_select->addMultiOption($language['iso6391_lng'], $language['name_lng']); */ $layout_select->addMultiOption('default', 'Default'); $layout_select->addMultiOption('custom', 'Custom'); //$layout_select->setValue($this->_getCurrentLayoutSelect()); $layout_select->setValue('default'); $submit = new Zend_Form_Element_Submit('submitLayoutSelection'); $submit->removeDecorator('DtDdWrapper'); $submit->setAttrib('style', 'display: none;'); $this->addElements(array($layout_select, $submit)); }
public function init() { /* $captcha = new Zend_Form_Element_Captcha('foo', array( 'label' => "Please verify you're a human", 'captcha' => 'Figlet', 'captchaOptions' => array( 'captcha' => 'Figlet', 'wordLen' => 6, 'timeout' => 300, ), )); $submit = new Zend_Form_Element_Submit('submit'); $submit->setlabel('submit') ->setIgnore(true); $this->addElements( array( $captcha,$submit)); }*/ $recaptchakeys = Zend_Registry::get('config.recaptcha'); $recaptcha = new Zend_Service_Recaptcha($recaptchakeys['publickeys'], $recaptchakeys['privatekeys'], NULL, array('theme' => 'red')); $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => 'type the characters', 'captcha' => 'Recaptcha', 'captchaOptions' => array('captcha' => 'Recaptcha', 'service' => $recaptcha))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setlabel('submit')->setIgnore(true); $this->addElements(array($captcha, $submit)); }
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')); }
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->setName('resource_activity_has_receipt'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); // // $resource_activity_has_receipt_types_id = new Zend_Form_Element_Select('resource_activity_has_receipt_types_id'); // $resource_activity_has_receipt_types_id->setLabel('resource_activity_has_receipt types') // ->addValidator('NotEmpty', true) // ->setmultiOptions($this->_selectOptions_types()) // ->setAttrib('maxlength', 200) // ->setAttrib('size', 1) // ->setAttrib("class", "toolboxdrop") // ->setDecorators(array(array('ViewScript', array( // 'viewScript' => 'forms/_element_select.phtml')))) // ; // // $resource_activity_has_receipt_types_id = new Zend_Form_Element_Multiselect('$resource_activity_has_receipt_types_id'); // $resource_activity_has_receipt_types_id->setLabel('resource_activity_has_receipt types') // ->setmultiOptions($this->_selectOptions_types()) // ->setAttrib('maxlength', 200) // ->setAttrib('size', 5) // ->setDecorators(array(array('ViewScript', array( // 'viewScript' => 'forms/_element_select.phtml')))) // ->setAttrib("class","toolboxdrop") // ; // $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $this->addElements(array($id, $name, $submit)); }
public function init() { /* $this->setDecorators(array( array('Description', array('tag' => 'p', 'class' => 'description','escape' => false)), 'formElements', 'fieldset', array('form',array('class' => 'formdefault')) )); $this->setElementDecorators(array( 'ViewHelper', 'Description', 'Label', 'Errors', array(array('tipo' => 'HtmlTag'), array('tag' => 'div')) ));*/ //$this->setAttrib('class','formdefault consumidorForm'); //$this->setLegend('Enviar Arquivos'); $this->setName('upload'); $this->setAttrib('enctype', 'multipart/form-data'); $description = new Zend_Form_Element_Text('description'); $description->setLabel('Description')->setRequired(true)->addValidator('NotEmpty'); $file = new Zend_Form_Element_File('arquivo'); $file->setLabel('Selecione os arquivos EDI"s Zipados')->setDestination('temp/arquivos/zip')->setRequired(true)->addValidator('Extension', false, 'zip'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Enviar'); $this->addElements(array($file, $submit)); }
/** * * Themes & styles * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap'); $css_theme = new Zend_Form_Element_Select('css_theme'); $css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control'); $wide_layout = new Zend_Form_Element_Checkbox('wide_layout'); $wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0"); $cover_ysize = new Zend_Form_Element_Text('cover_ysize'); $cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control'); $user_background = new Zend_Form_Element_Checkbox('user_background'); $user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background'); $subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $custom_css = new Zend_Form_Element_Textarea('css_custom'); $custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit)); $this->postInit(); }
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); $oMessage = new Zend_Form_Element_Textarea("message"); $oMessage->setFilters($this->_aFilters); $oMessage->setRequired(FALSE); $oMessage->removeDecorator("label"); $this->addElement($oMessage); $oIsDing = new Zend_Form_Element_Checkbox("is_ding"); $oIsDing->setLabel("Włącz dźwięk"); $oIsDing->setValue(1); $this->addElement($oIsDing); $oSubmit = new Zend_Form_Element_Submit("send_message"); $oSubmit->setLabel("Wyślij wiadomość"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/chat.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
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')); }
public function init() { $this->setName('contact'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); // // $company_id = new Zend_Form_Element_Hidden('company_id'); // $company_id->addFilter('Int'); // $company_id->removeDecorator('label'); // $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $telephone = new Zend_Form_Element_Text('telephone'); $telephone->setLabel('Telephone')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $status = new Zend_Form_Element_Text('status'); $status->setLabel('Status')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $direction = new Zend_Form_Element_Text('direction'); $direction->setLabel('Direction')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $this->addElements(array($id, $name, $email, $telephone, $direction, $status, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $this->setName('safcontrollers'); $id = new Zend_Form_Element_Hidden('id'); $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $label = new Zend_Form_Element_Text('label'); $label->setLabel('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name'); $image = new Zend_Form_Element_Textarea('image'); $image->setLabel('image'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('description'); $safmodulesId = new Zend_Form_Element_Select('safmodules_id'); $options = new Safmodules(); $safmodulesId->addMultiOption('', '----------'); foreach ($options->fetchAlltoFlatArray() as $k => $v) { $safmodulesId->addMultiOption($k, $v['mlabel']); } $safmodulesId->setLabel('safmodules_id'); $this->addElements(array($id, $hash, $label, $name, $image, $description, $safmodulesId)); $this->addElements(array($submit)); }
public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $checkEmailNotJunk = new Zend_Validate_Callback(array($this, 'emailNotJetable')); $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email')); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => $this->t('Email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $checkEmailNotJunk, $uniqueEmailValidator))); $this->addElement($email); $raisonsocial = new Zend_Form_Element_Text('raison sociale'); $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($raisonsocial); // $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3))); // $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100)); $this->addElement($submit); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('suggested'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array('Please choose a level' => NULL, 'Research levels' => $projectype_list))->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array('Please choose a period' => NULL, 'Periods available' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.')->setDecorators($decorators); $description = $this->addElement('Textarea', 'description', array('label' => 'Short description of project: ')); $description = $this->getElement('description')->setRequired(false)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->setAttribs(array('cols' => 80, 'rows' => 10))->addDecorator('HtmlTag', array('tag' => 'li')); $valid = new Zend_Form_Element_Checkbox('taken'); $valid->setLabel('Is the topic taken: ')->setRequired(true)->setDecorators($decorators)->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->removeDecorator('label')->removeDecorator('HtmlTag')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper'); $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash)); $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function init() { parent::init(); if (!$this->getHmHomeId()) { throw new Exception(); } $element = new Zend_Form_Element_Select('year'); $element->setLabel('Jaar')->setRequired(true)->addMultiOption('', '...'); $percentages = Model_Hm_Day_Percentage::findAllByHomeId($this->_hmHomeId)->execute(null, Doctrine_Core::HYDRATE_ARRAY); $availableYears = new Model_Hm_AvailableYears($percentages, 5); foreach ($availableYears->toArray() as $year) { $element->addMultiOption($year, $year); } $this->addElement($element); $elements[] = 'year'; for ($i = 1; $i <= 7; $i++) { $elementName = $this->_labelTemplates[$i]; $elements[] = 'day_' . $i; $element = new Zend_Form_Element_Text('day_' . $i); $element->setLabel($elementName)->setRequired(true)->setAttribs(array('maxlength' => 6))->setValidators(array(array('float'), array('stringLength', false, array('max' => 6)))); $this->addElement($element); } $this->addDisplayGroup($elements, 'days', array('legend' => 'Percentage')); $element = new Zend_Form_Element_Submit('submit_percentageday'); $element->setLabel('Verwerken')->setAttrib('class', 'submit'); $this->addElement($element); $this->addDisplayGroup(array('submit_percentageday'), 'submit', array('class' => 'submit')); $this->bhvkDecorators(); $this->bhvkDecorateSubmitElement($this->getElement('submit_percentageday')); }
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')); }
public function __construct($options = null) { parent::__construct($options); $id = new Zend_Form_Element_Hidden('id'); $hierarchyLevel = new Zend_Form_Element_Hidden('hierarchyLevel'); $officeType = new Zend_Form_Element_Text('officeType'); $officeType->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(4, 50)))); // $officeType->addValidator($db_lookup_validator); $officeType->setAttrib('class', 'txt_put'); $officeType->setAttrib('id', 'officeType'); $officeCode = new Zend_Form_Element_Text('officeCode'); //add validation $officeCode->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(2, 2)))); $officeCode->setAttrib('class', 'txt_put'); $officeCode->setAttrib('id', 'officeCode')->setAttrib('size', '2'); $this->addElements(array($id, $officeType, $officeCode, $hierarchyLevel)); $submit = new Zend_Form_Element_Submit('Edit'); $submit->setAttrib('class', 'officebutton'); $submit->setLabel('edit'); $submit->removeDecorator('DtDdWrapper'); $next = new Zend_Form_Element_Submit('Next'); $next->setAttrib('class', 'officesubmit'); $next->setLabel('Next'); //add form element to form $this->addElements(array($submit, $next)); }
public function __construct($options = null) { parent::__construct($options); $accountId1 = new Zend_Form_Element_Hidden('accountId'); $productId1 = new Zend_Form_Element_Hidden('productId'); $memberId1 = new Zend_Form_Element_Hidden('memberId'); $maturedamount = new Zend_Form_Element_Hidden('maturedinterestamount'); $interestamountto = new Zend_Form_Element_Hidden('interestamountto'); $capitalamount = new Zend_Form_Element_Hidden('capitalamount'); $penalinterest = new Zend_Form_Element_Hidden('penalinterest'); $paymenttype = new Zend_Form_Element_Select('paymenttype'); $paymenttype->addMultiOption('', 'select..'); $paymenttype->setAttrib('class', 'NormalBtn'); $paymenttype->setAttrib('id', 'paymenttype'); $paymenttype->setAttrib('onchange', 'toggleField();'); $paymenttype->setRequired(true); $description = new Zend_Form_Element_Textarea('transactiondescription'); $description->setAttrib('class', 'textfield'); $description->setAttrib('rows', '2'); $description->setAttrib('cols', '20'); $no = new Zend_Form_Element_Textarea('paymenttype_details'); $no->setAttrib('class', 'textfield'); $no->setAttrib('rows', '1'); $no->setAttrib('cols', '20'); $no->setAttrib('id', 'paymenttype_details'); $no->setAttrib('style', 'display:none;'); $no->setRequired(true); $submit = new Zend_Form_Element_Submit('Finalize'); $submit->setLabel('Finalize'); $submit->setAttrib('class', 'recurring'); $this->addElements(array($accountId1, $productId1, $memberId1, $maturedamount, $submit, $capitalamount, $interestamountto, $penalinterest, $paymenttype, $description, $no)); }