public function init() { global $mySession; $db = new Db(); $ConfigData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'"); $SiteTitle = $ConfigData[0]['site_title']; $MetaDescription = $ConfigData[0]['site_description']; $MetaKeyword = $ConfigData[0]['site_keyword']; $AdminEmail = $ConfigData[0]['admin_email']; $PaypalEmail = $ConfigData[0]['paypal_email']; $welcomemessageC = $ConfigData[0]['welcomemessage']; $admin_name_value = $ConfigData[0]['admin_fullname']; $site_title = new Zend_Form_Element_Text('site_title'); $site_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($SiteTitle); $admin_name = new Zend_Form_Element_Text('admin_name'); $admin_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Admin name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($admin_name_value); $site_description = new Zend_Form_Element_Text('site_description'); $site_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaDescription); $site_keyword = new Zend_Form_Element_Text('site_keyword'); $site_keyword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site keyword is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaKeyword); $admin_email = new Zend_Form_Element_Text('admin_email'); $admin_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Administrator email is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($AdminEmail); $paypal_email = new Zend_Form_Element_Text('paypal_email'); $paypal_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Paypal email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($PaypalEmail); /*$currency_symbol= new Zend_Form_Element_Text('currency_symbol'); $currency_symbol->setRequired(true) ->addValidator('NotEmpty',true,array('messages' =>'Currency symbol is required.')) ->addDecorator('Errors', array('class'=>'error')) ->setAttrib("class","required") ->setValue($CurrencySymbol);*/ $welcomemessage = new Zend_Form_Element_Textarea('welcomemessage'); $welcomemessage->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($welcomemessageC); $this->addElements(array($site_title, $admin_name, $site_description, $site_keyword, $admin_email, $paypal_email, $welcomemessage)); }
public function init() { global $mySession; $db = new Db(); $emailid_val = ""; $qur = $db->runquery("SELECT * FROM " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' "); //$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' "); if ($qur != "" and count($qur) > 0) { $emailid_val = $qur[0]['emailid']; } # FORM ELEMENT:public name # TYPE : text $emailid = new Zend_Form_Element_Text('emailid'); $emailid->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib('readonly', 'readonly')->setAttrib("style", "width:300px; height:30px;")->setValue($emailid_val); # FORM ELEMENT:address # TYPE : text $friendsemailid = new Zend_Form_Element_Text('friendsemailid'); $friendsemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'One id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:300px; height:30px;")->setAttrib('class', 'changepasstextbox'); //if(@$_REQUEST['friendsemailid']!="") // { // $friendsemailid-> addValidator('EmailAddress', true) // ->addDecorator('Errors', array('class'=>'errmsg')) // ->addErrorMessage('Please enter a valid email address'); // } // # FORM ELEMENT:city # TYPE : text $url = new Zend_Form_Element_Text('url'); $url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:100px; height:30px;"); $this->addElements(array($emailid, $friendsemailid, $url)); }
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')); }
/** * @author code generate * @return mixed */ public function __construct($option = array()) { $classId = new Zend_Form_Element_Hidden('UserId'); $classId->setDecorators(array('ViewHelper')); $this->addElement($classId); $email = new Zend_Form_Element_Text('Email'); $email->setLabel('Email *'); $email->addFilter('StringTrim'); $email->setRequired(true); $email->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $email->addValidator(new Zend_Validate_Db_NoRecordExists("Users", "Email")); $email->addValidator('EmailAddress', true); $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp"))); $this->addElement($email); $save = new Zend_Form_Element_Submit('Save'); $save->setLabel('Đăng ký'); $save->setAttrib('class', 'btn btn-primary'); $save->setDecorators(array('ViewHelper')); $this->addElement($save); $reset = new Zend_Form_Element_Reset('Reset'); $reset->setLabel('Làm lại'); $reset->setAttrib('class', 'btn btn-primary'); $reset->setDecorators(array('ViewHelper')); $this->addElement($reset); }
public function __construct() { $transactionType = new Zend_Form_Element_Select('transactionType'); $transactionType->setAttrib('class', 'NormalBtn'); $transactionType->setRequired(true)->addValidators(array(array('NotEmpty'))); $transactionMode = new Zend_Form_Element_Select('transactionMode'); $transactionMode->setAttrib('class', 'NormalBtn'); $transactionMode->setRequired(true); // ->addValidators(array(array('NotEmpty'))); $transactionMode->setAttrib('onchange', 'display(this.value);'); $transaction_interest_amount = new Zend_Form_Element_Text('transaction_interest_amount'); $transaction_interest_amount->setAttrib('class', 'NormalBtn'); $transaction_fine_amount = new Zend_Form_Element_Text('transaction_fine_amount'); $transaction_fine_amount->setAttrib('class', 'NormalBtn'); $account_id = new Zend_Form_Element_Text('account_id'); $account_id->setAttrib('class', 'NormalBtn'); $transaction_date = new Zend_Form_Element_Text('transaction_date'); $transaction_date->setAttrib('class', 'NormalBtn'); $transaction_date->setRequired(true)->addValidators(array(array('NotEmpty'))); $transaction_date->setRequired(true)->addValidator(new Zend_Validate_Date('YYYY-MM-DD'), true, array('messages' => array(Zend_Validate_Date::FALSEFORMAT => 'Enter the valid date'))); $transaction_amount = new Zend_Form_Element_Text('transaction_amount'); $transaction_amount->setAttrib('class', 'NormalBtn'); $transaction_remarks = new Zend_Form_Element_Textarea('transaction_remarks', array('rows' => 3, 'cols' => 15)); $transaction_remarks->setAttrib('class', 'NormalBtn'); $transaction_remarks->setRequired(true)->addValidators(array(array('NotEmpty'))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit'); $submit->setAttrib('class', 'NormalBtn'); $submit->setLabel('submit'); $this->addElements(array($transactionType, $transactionMode, $transaction_interest_amount, $transaction_fine_amount, $account_id, $transaction_date, $transaction_amount, $transaction_remarks, $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->setDecorators(array(array('ViewScript', array('viewScript' => 'form/daterange.phtml')))); // Add start date element $startDate = new Zend_Form_Element_Text('his_date_start'); $startDate->class = 'input_text'; $startDate->setRequired(true)->setLabel('Date Start:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array('ViewHelper')); $startDate->setAttrib('alt', 'date'); $this->addElement($startDate); // Add start time element $startTime = new Zend_Form_Element_Text('his_time_start'); $startTime->class = 'input_text'; $startTime->setRequired(true)->setValue('00:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper')); $startTime->setAttrib('alt', 'time'); $this->addElement($startTime); // Add end date element $endDate = new Zend_Form_Element_Text('his_date_end'); $endDate->class = 'input_text'; $endDate->setRequired(true)->setLabel('Date End:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array('ViewHelper')); $endDate->setAttrib('alt', 'date'); $this->addElement($endDate); // Add end time element $endTime = new Zend_Form_Element_Text('his_time_end'); $endTime->class = 'input_text'; $endTime->setRequired(true)->setValue('01:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper')); $endTime->setAttrib('alt', 'time'); $this->addElement($endTime); }
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->setAttrib('action', BASE_URL . 'timeformat/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'timeformat'); $id = new Zend_Form_Element_Hidden('id'); $timeformat = new Zend_Form_Element_Text('timeformat'); $timeformat->setAttrib('maxLength', 20); $timeformat->addFilter(new Zend_Filter_StringTrim()); $timeformat->setRequired(true); $timeformat->addValidator('NotEmpty', false, array('messages' => 'Please enter time format.')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'timeformat/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'timeformat\\');'"; $this->addElements(array($id, $timeformat, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setAction(URL_BASE . '/action'); $tr = Zend_Registry::get('tr'); $name = new Zend_Form_Element_Text('name'); $name->setLabel($tr->_('NAME')); $name->setRequired(true); $name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel($tr->_('IS_ACTION_ENABLED')); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel($tr->_('IS_ACTION_PUBLIC')); $this->addElement($public); $route = new Zend_Form_Element_Text('route'); $route->setLabel($tr->_('CUSTOM_ROUTE')); $route->setRequired(true); $route->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 35; $desc->rows = 15; $desc->setLabel($tr->_('DESCRIPTION')); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
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() { // Add start date element $startDate = new Zend_Form_Element_Text('add_show_start_date'); $startDate->class = 'input_text'; $startDate->setRequired(true)->setLabel('Date/Time Start:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array(array(array('open' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)), 'ViewHelper', 'Description', array('Label', array('tag' => 'dt')))); $this->addElement($startDate); // Add start time element $startTime = new Zend_Form_Element_Text('add_show_start_time'); $startTime->class = 'input_text'; $startTime->setRequired(true)->setValue('00:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper', 'Errors', array(array('close' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($startTime); // Add end date element $endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat'); $endDate->class = 'input_text'; $endDate->setRequired(true)->setLabel('Date/Time End:')->setValue(date("Y-m-d"))->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('YYYY-MM-DD'))))->setDecorators(array(array(array('open' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)), 'ViewHelper', 'Description', array('Label', array('tag' => 'dt')))); $this->addElement($endDate); // Add end time element $endTime = new Zend_Form_Element_Text('add_show_end_time'); $endTime->class = 'input_text'; $endTime->setRequired(true)->setValue('01:00')->setFilters(array('StringTrim'))->setValidators(array('NotEmpty', array('date', false, array('HH:mm')), array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))->setDecorators(array('ViewHelper', 'Errors', array(array('close' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($endTime); // Add duration element $this->addElement('text', 'add_show_duration', array('label' => 'Duration:', 'class' => 'input_text', 'value' => '01h00m', 'readonly' => true)); // Add repeats element $this->addElement('checkbox', 'add_show_repeats', array('label' => 'Repeats?', 'required' => false)); }
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')); }
private function _setupElements() { $translate = Zend_Registry::get('Zend_Translate'); $this->setAttrib('id', 'signupForm'); $this->setTranslator($translate); $email = new Zend_Form_Element_Text('email'); $email->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'email')->addValidator('EmailAddress'); $email->addValidator(new Ziown_Form_Validate_EmailAddress(), false); $email->getValidator('NotEmpty')->setMessage('Email Address is Required', 'isEmpty'); $username = new Zend_Form_Element_Text('username'); $username->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'username'); $username->addValidator(new Ziown_Form_Validate_UserName()); $username->getValidator('NotEmpty')->setMessage('User name is Required', 'isEmpty'); $password = new Zend_Form_Element_Password('password'); $password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-password')->setErrorMessages(array('Password is required')); $identValidator = new Zend_Validate_Identical($_POST['password']); $identValidator->setMessages(array('notSame' => 'Password doesn\'t match!', 'missingToken' => 'Password doesn\'t match!')); $confirm_password = new Zend_Form_Element_Password('confirm_password'); $confirm_password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-confirm-password')->addValidator($identValidator); $signup = new Zend_Form_Element_Submit('signup'); $signup->setLabel('Sign Up'); $signup->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'u-login'); $this->setDecorators(array(array('ViewScript', array('script' => 'signup.phtml')))); $this->addElements(array($username, $password, $confirm_password, $signup, $email)); }
public function init() { // Set form options $this->setName('userShippingAddress')->setMethod('post'); // Address One $addressOne = new Zend_Form_Element_Text('addressOne'); $addressOne->setRequired(true); // Address One $addressTwo = new Zend_Form_Element_Text('addressTwo'); $addressTwo->setRequired(false); // City $city = new Zend_Form_Element_Text('city'); $city->setRequired(true); // State $state = new Zend_Form_Element_Text('state'); $state->setRequired(true); // Country $country = new Zend_Form_Element_Text('country'); $country->setRequired(true); // ZIP $zip = new Zend_Form_Element_Text('zip'); $zip->setRequired(true); // Is Default Shipping? $defaultShipping = new Zend_Form_Element_Checkbox('defaultShipping'); $defaultShipping->setRequired(false); // Add all the elements to the form $this->addElement($addressOne)->addElement($addressTwo)->addElement($city)->addElement($state)->addElement($country)->addElement($zip)->addElement($defaultShipping); }
public function _initAttributeValue() { $element = new Zend_Form_Element_Text('attribute_value'); $element->setRequired(true); $element->setAllowEmpty(false); return $this->addElement($element); }
public function init() { // Set form options $this->setName('productBasicInfo')->setAction(SITE_ROOT . '/productlisting/' . $this->postAction)->setMethod('post'); //name $name = new Zend_Form_Element_Text('name'); $name->setRequired(true)->addValidator('Alnum')->addvalidator('StringLength', false, array(4, 150)); //brand $brand = new Zend_Form_Element_Select('brand'); $brand->setRequired(true)->addValidator('Alnum'); //social_usage $socialUsage = new Zend_Form_Element_Checkbox('socialUsage'); $competativeUsage = new Zend_Form_Element_Checkbox('competativeUsage'); $price = new Zend_form_Element_Text('price'); $price->setRequired(true)->addValidator(new Zend_Validate_Float(), true); //domestic shipping rate $domesticShippingRate = new Zend_Form_Element_Text('domesticShippingRate'); $domesticShippingRate->setRequired(true)->addValidator(new Zend_Validate_Float(), true); //international shipping rate $internationalShippingRate = new Zend_Form_Element_Text('internationalShippingRate'); $internationalShippingRate->setRequired(true)->addValidator(new Custom_Validators_Price(), true); //backordertime $backorderTime = new Zend_Form_Element_Text('backorderTime'); //returnable $return = new Zend_Form_Element_Radio('return'); $return->setLabel('Return:')->addMultiOptions(array('returnable' => 'Returnable', 'Unreturnable' => 'Not returnable'))->setSeparator(" ")->setAttrib("checked", "checked"); //videos $video = new Zend_Form_Element_Text('videoYoutube'); // Add all the elements to the form $this->addElement($name)->addElement($brand)->addElement($socialUsage)->addElement($competativeUsage)->addElement($price)->addElement($domesticShippingRate)->addElement($internationalShippingRate)->addElement($backorderTime)->addElement($return)->addElement($video); }
public function myInit($Id) { global $mySession; $db = new Db(); if ($Id != "") { $adminData = $db->runQuery("select * from " . TSHIRT_ICONS . " where id='" . $Id . "'"); $title_value = $adminData[0]['title']; $oldicon_value = $adminData[0]['icon']; $colorcode_value = $adminData[0]['colorcode']; } else { $title_value = ''; $oldicon_value = ''; $colorcode_value = ''; } $title = new Zend_Form_Element_Text('title'); $title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($title_value); $colorcode = new Zend_Form_Element_Text('colorcode'); $colorcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please enter color code.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "Expandable mws-textinput required")->setAttrib("onkeypress", "return checknummspK(event)")->setValue($colorcode_value); $this->addElement($colorcode); $this->addElement($title); if ($Id == "") { $image = new Zend_Form_Element_File('image'); $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select an icon.'))->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error')); } else { $image = new Zend_Form_Element_File('image'); $image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox"); } $this->addElement($image); if ($Id != "") { $oldicon = new Zend_Form_Element_Hidden('oldicon'); $oldicon->setValue($oldicon_value); $this->addElement($oldicon); $this->addElement("hidden", "foo", array("decorators" => array(array(array("img" => "HtmlTag"), array("tag" => "img", "openOnly" => true, "src" => IMAGES_URL . 'tshirt-icons/' . $oldicon_value, "align" => "middle", "class" => "myClass", "style" => "max-width:200px;max-height:200px;")), array("ViewHelper"), array(array("span" => "HtmlTag"), array("tag" => "span", "class" => "myElement", "style" => "text-align:center;display:block;"))))); } }
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() { $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel('Is the action enabled ?'); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel('Is the action public ?'); $this->addElement($public); $use_custom_route = new Zend_Form_Element_Checkbox('use_custom_route'); $use_custom_route->setLabel('Custom Route'); $this->addElement($use_custom_route); $custom_route = new Zend_Form_Element_Text('route'); //$custom_route->setLabel('Custom Route'); $this->addElement($custom_route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 40; $desc->rows = 15; $desc->setLabel('Description'); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
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')); }
function setForm() { $form = new Zend_Form; $form->setMethod('post')->setAction(''); //$this->setAttrib('enctype','multipart/form-data'); $file = new Zend_Form_Element_File('video_file'); //$file->setAttrib('class','file'); $file->setLabel('video_file'); $file->setRequired(true); $video_title = new Zend_Form_Element_Text('video_title'); $video_title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống')); $video_thumbnail=new Zend_Form_Element_Textarea('video_thumbnail'); $video_thumbnail->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_description = new Zend_Form_Element_Textarea('video_description'); $video_description->setAttrib('rows','7'); $video_description ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống')); $is_active = new Zend_Form_Element_Radio('is_active'); $is_active->setRequired(true) ->setLabel('is_active') ->setMultiOptions(array("1" => "Có","0" => "Không")); $file->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_title->removeDecorator('HtmlTag')->removeDecorator('Label'); $video_description->removeDecorator('HtmlTag')->removeDecorator('Label'); $is_active->removeDecorator('HtmlTag')->removeDecorator('Label'); $form->addElements(array($file,$video_title,$video_description,$is_active,$video_thumbnail)); return $form; }
public function init() { $tr = Zend_Registry::get('tr'); $handle = new Zend_Form_Element_Text('handle'); $handle->setLabel($tr->_('HANDLE')); $handle->setRequired(true); $handle->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($handle); $password = new Zend_Form_Element_Password('password'); $password->setLabel($tr->_('PASSWORD')); $password->setRequired(true); $password->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($password); $password1 = new Zend_Form_Element_Password('password_again'); $password1->setLabel($tr->_('RETYPE') . ' ' . $tr->_('PASSWORD')); $password1->setRequired(true); $password1->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($password1); $this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT'))); parent::init(); }
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 __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(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); $oFormSliderEditId = new Zend_Form_Element_Hidden("slider_edit_id"); $oFormSliderEditId->setValue(0); $oFormSliderEditId->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormSliderEditId); $oSliderName = new Zend_Form_Element_Text("name"); $oSliderName->setLabel("Nazwa slidera:"); $oSliderName->addValidator(new Zend_Validate_StringLength(array("min" => 3, "max" => 45))); $oSliderName->setRequired(TRUE); $oSliderName->setAttrib("class", "valid"); $this->addElement($oSliderName); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $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"); } }
public function init($catId) { global $mySession; $db = new Db(); $catname = ""; $catdescription = ""; if ($catId != "") { $Data = $db->runQuery("select * from " . CATEGORY . " where cat_id='" . $catId . "'"); $catname = $Data[0]['cat_name']; $catdescription = $Data[0]['cat_description']; } $cat_name = new Zend_Form_Element_Text('cat_name'); $cat_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category name is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catname); $cat_description = new Zend_Form_Element_Textarea('cat_description'); $cat_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category description is required.'))->addDecorator('Errors', array('class' => 'errormsg'))->setAttrib("class", "mws-textinput required")->setValue($catdescription); /* $pagepositionArr=array(); $pagepositionArr[0]['key']="0"; $pagepositionArr[0]['value']="Top"; $pagepositionArr[1]['key']="1"; $pagepositionArr[1]['value']="Bottom"; $pageposition= new Zend_Form_Element_Radio('pageposition'); $pageposition->addMultiOptions($pagepositionArr) ->setValue($pageposition_value); */ $this->addElements(array($cat_name, $cat_description)); }
public function init($pageId) { global $mySession; $db = new Db(); $PageTitle = ""; $PageContent = ""; $PageMetaKeyword = ""; $PageMetaDescription = ""; if ($pageId != "") { $PageData = $db->runQuery("select * from " . PAGES1 . " where page_id='" . $pageId . "'"); // prd($PageData); $PageTitle = $PageData[0]['page_title']; $PageContent = $PageData[0]['page_content']; $PageMetaKeyword = $PageData[0]['meta_keywords']; $PageMetaDescription = $PageData[0]['meta_description']; $PageSynonyms = $PageData[0]['synonyms']; } $page_title = new Zend_Form_Element_Text('page_title'); $page_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageTitle); $page_content = new Zend_Form_Element_Textarea('page_content'); $page_content->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Page content is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($PageContent); $meta_keywords = new Zend_Form_Element_Text('meta_keywords'); $meta_keywords->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Keywords are required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageMetaKeyword); $meta_description = new Zend_Form_Element_Text('meta_description'); $meta_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageMetaDescription); $synonyms = new Zend_Form_Element_Text('synonyms'); $synonyms->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($PageSynonyms); $this->addElements(array($page_title, $page_content, $meta_keywords, $meta_description, $synonyms)); }
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 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); }