public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'holidaygroups'); $id = new Zend_Form_Element_Hidden('id'); $holidayname = new Zend_Form_Element_Text('holidayname'); $holidayname->setAttrib('maxLength', 20); $holidayname->addFilter(new Zend_Filter_StringTrim()); $holidayname->setRequired(true); $holidayname->addValidator('NotEmpty', false, array('messages' => 'Please enter holiday.')); $holidayname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid holiday.'))); $groupid = new Zend_Form_Element_Multiselect('groupid'); $groupid->setAttrib('class', 'selectoption'); $groupid->setRegisterInArrayValidator(false); $groupid->setRequired(true); $groupid->addValidator('NotEmpty', false, array('messages' => 'Please select holiday group.')); $holiday_date = new ZendX_JQuery_Form_Element_DatePicker('holidaydate'); $holiday_date->setAttrib('readonly', 'true'); $holiday_date->setAttrib('onfocus', 'this.blur()'); $holiday_date->setOptions(array('class' => 'brdr_none')); $holiday_date->setRequired(true); $holiday_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $holidayname, $groupid, $holiday_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('holidaydate')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'timezone/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'timezone'); $id = new Zend_Form_Element_Hidden('id'); $timezone = new Zend_Form_Element_Multiselect('timezone'); $timezone->setRegisterInArrayValidator(false); $timezone->setRequired(true); $timezone->addValidator('NotEmpty', false, array('messages' => 'Please select time zone.')); $timezoneModal = new Default_Model_Timezone(); $timezoneData = $timezoneModal->getalltimezones(); foreach ($timezoneData as $data) { $timezone->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $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 = "'timezone/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'timezone\\');'"; $this->addElements(array($id, $timezone, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'attendancestatuscode/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'attendancestatuscode'); $id = new Zend_Form_Element_Hidden('id'); $attendancestatuscode = new Zend_Form_Element_Text('attendancestatuscode'); $attendancestatuscode->setAttrib('maxLength', 20); //$attendancestatuscode->addFilter(new Zend_Filter_StringTrim()); $attendancestatuscode->setRequired(true); $attendancestatuscode->addValidator('NotEmpty', false, array('messages' => 'Please enter attendance status.')); $attendancestatuscode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid attendance status.'))); $attendancestatuscode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_attendancestatuscode', 'field' => 'attendancestatuscode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $attendancestatuscode->getValidator('Db_NoRecordExists')->setMessage('Attendance status already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $attendancestatuscode, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod("post"); $title = new Zend_Form_Element_Text("title"); $title->setAttrib("placeholder", "Title"); $title->setAttrib("class", "form-control"); $title->setLabel("Title: "); $title->setRequired(); $body = new Zend_Form_Element_Textarea("body"); $body->setAttrib("class", "form-control"); $body->setAttrib("placeholder", "Write body here...."); $body->setLabel("Body: "); $body->setAttrib("rows", "5"); $body->setAttrib("cols", "55"); $body->setRequired(); $picture = new Zend_Form_Element_File('picture'); $picture->setLabel("Picture:"); $picture->setRequired(); $picture->setDestination('/var/www/html/RNR/public/images/thread'); $stick = new Zend_Form_Element_Radio("stick"); $stick->setLabel("Sticky:"); $stick->addMultiOption("on", "on"); $stick->addMultiOption("off", "off"); $stick->setRequired(); $id = new Zend_Form_Element_Hidden("id"); $submit = new Zend_Form_Element_Submit("Submit"); $submit->setAttrib("class", "btn btn-primary"); $submit->setLabel("Save"); $rest = new Zend_Form_Element_Submit('Rest'); $rest->setAttrib("class", "btn btn-info"); $this->addElements(array($id, $title, $body, $picture, $stick, $submit, $rest)); }
public function __construct($options = null) { parent::__construct($options); parent::__construct(); $accountCode = new Zend_Form_Element_Hidden('accountcode'); $memberId = new Zend_Form_Element_Hidden('membercode'); $categoryId = new Zend_Form_Element_Hidden('categoryId'); $newStatus = new Zend_Form_Element_Select('newStatus'); $newStatus->setAttrib('class', 'NormalBtn'); $newStatus->setRequired(true); $newStatus->addMultiOption('', 'Select...'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', '2'); $description->setAttrib('cols', '20'); $description->setRequired(true); $totalamount = new Zend_Form_Element_Text('totalamount'); $totalamount->setAttrib('class', 'textfield'); $totalamount->setAttrib('id', 'totalamount'); $totalamount->setAttrib('readonly', 'true'); $newStatus1 = new Zend_Form_Element_Hidden('newStatus1'); $description1 = new Zend_Form_Element_Hidden('description1'); $totalamount1 = new Zend_Form_Element_Hidden('totalamount1'); $confirm = new Zend_Form_Element_Submit('confirm'); $confirm->setAttrib('class', 'officesubmit'); $submit = new Zend_Form_Element_Submit('Submit'); $submit->setAttrib('class', 'officesubmit'); $this->addElements(array($submit, $newStatus, $description, $accountCode, $memberId, $categoryId, $totalamount, $confirm, $newStatus1, $description1, $totalamount1)); }
public function init() { /* Form Elements & Other Definitions Here ... */ $name = new Zend_Form_Element_Text("name"); $name->setLabel("You Name : "); $name->setRequired(true); $website = new Zend_Form_Element_Text("website"); $website->setLabel("Your Website : "); $website->setDescription(" http://www.google.com "); $email = new Zend_Form_Element_Text("email"); $email->setLabel("Email Address : "); $email->setDescription(" Example : john@googe.com "); $email->addValidator("EmailAddress", false, array('messages' => array(Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid Email Address Ya tayeb"))); $email->setRequired(true); $body = new Zend_Form_Element_Textarea("body"); $body->setLabel("Text Message : "); $body->setAttrib("class", "textbox"); $body->setAttrib("rows", "6"); $body->setAttrib("cols", "60"); $body->setRequired(true); $submit = new Zend_Form_Element_Submit("contact"); $this->addElement($name); $this->addElements(array($website, $email, $body, $submit)); $this->addElement("hash", "contact_us_hash_form"); }
public function __construct($loanamount) { Zend_Dojo::enableForm($this); parent::__construct($loanamount); //$fieldtype,$fieldname,$table,$columnname,$cssname,$labelname,$required,$validationtype,$min,$max,$rows,$cols,$decorator,$value $formfield = new App_Form_Field(); $date = new ZendX_JQuery_Form_Element_DatePicker('date'); $date->setAttrib('class', 'txt_put'); $date->setJQueryParam('dateFormat', 'yy-mm-dd'); $date->setRequired(true); $Amount = new Zend_Form_Element_Text('Amount'); $Amount->setAttrib('class', 'textfield'); $lessthan = new Zend_Validate_LessThan(array('max' => $loanamount + 1, 'inclusive' => false)); $Amount->setRequired(true)->addValidators(array(array('NotEmpty'), array('Float'), array($lessthan, true))); $transactionMode = $formfield->field('Select', 'transactionMode', '', '', 'tmode', '', true, '', '', '', '', '', 0, ''); $etransfer = $formfield->field('Select', 'etransfer', '', '', 'etran', '', false, '', '', '', '', '', 0, ''); $etransfer->setRegisterInArrayValidator(false); $memberid = $formfield->field('Hidden', 'memberid', '', '', 'memberclass', '', false, '', '', '', '', '', 0, ''); $membertypeid = $formfield->field('Hidden', 'membertypeid', '', '', 'membertypeclass', '', false, '', '', '', '', '', 0, ''); $pathhidden = $formfield->field('Hidden', 'pathhidden', '', '', 'pathclass', '', false, '', '', '', '', '', 0, ''); $othrtext = new Zend_Form_Element_Text('othertext'); $othrtext->setAttrib('size', 12); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', '2'); $description->setAttrib('cols', '20'); $description->setRequired(true); $sms = new Zend_Form_Element_Checkbox('sms'); $back = new Zend_Form_Element_Submit('Back'); $back->setAttrib('id', 'button2'); $submit = new Zend_Form_Element_Submit('Submit'); $submit->setAttrib('id', 'button'); $this->addElements(array($date, $Amount, $transactionMode, $etransfer, $othrtext, $description, $sms, $memberid, $pathhidden, $membertypeid, $submit, $back)); }
protected function buildElements() { // Quick search field $full_name = new Zend_Form_Element_Text('fullname'); $full_name->setLabel('Your Name:'); $full_name->setAttrib('class', 'contactforminput'); $full_name->setAttrib('hint', 'your name'); $this->addElement($full_name); // create EMAIL input tag // Unique check, require, email address valid check, length less than 100(database length for this field) // do email address validation(default each email element do email address validation) $credit_email = new Zend_Form_Element_Text('email_from'); $credit_email->setLabel('Your Email:'); $credit_email->setAttrib('class', 'contactforminput'); $this->addElement($credit_email); // create Description Textarea tag // filed type in db is Text $description = new Zend_Form_Element_Textarea('question'); $description->setLabel('Your Question:'); $description->setAttrib('class', 'contactforminput'); $description->setAttrib('hint', 'your question'); $this->addElement($description); // Quick search btn $send = new Zend_Form_Element_Image('submit'); $send->setImage('/images/sitetemplate/send_button.png'); $send->setAttribs(array('rows' => 22, 'cols' => 60)); $send->setImageValue(true); $this->addElement($send); $this->setName("contactform"); $this->setAttrib("onSubmit", "return ValidateForm();"); }
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->setAttribs(array('id' => 'form-exposicao-add')); // exposicao_nome $exposicao_nome = new Zend_Form_Element_Text("exposicao_nome"); $exposicao_nome->setLabel("Nome da Exposição:"); $exposicao_nome->setAttrib('placeholder', 'Digite o nome de sua exposição'); $exposicao_nome->setRequired(); //exposicao_descricao $exposicao_descricao = new Zend_Form_Element_Textarea("exposicao_descricao"); $exposicao_descricao->setLabel("Descrição da Exposição:"); $exposicao_descricao->setAttrib('placeholder', 'Conte aos usuários sobre sua exposição'); $exposicao_descricao->setAttrib('rows', 10); $exposicao_descricao->setRequired(); // tipo_exposicao_id $tipo_exposicao_id = new Zend_Form_Element_Select("tipo_exposicao_id"); $tipo_exposicao_id->setLabel("Categoria da Exposição:"); $tipo_exposicao_id->setRequired(); $tipo_exposicao_id->setMultiOptions($this->getTipoExposicao()); //exposicao_capa $exposicao_capa = new Zend_Form_Element_File("files"); $exposicao_capa->setLabel("Selecione a capa:"); $exposicao_capa->setDestination(Zend_Registry::get('config')->path->images->exposicao->capa); $exposicao_capa->addValidator('Extension', false, 'jpg,png,gif'); $exposicao_capa->addValidator('Size', false, 2097152)->setMaxFileSize(2097152); $exposicao_capa->setAttrib('id', 'exposicao_capa'); $exposicao_capa->setRequired(); // add elements $this->addElement($exposicao_nome); $this->addElement($exposicao_descricao); $this->addElement($tipo_exposicao_id); $this->addElement($exposicao_capa); parent::init(); }
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 __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)); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'workeligibilitydoctypes/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'workeligibilitydoctypes'); $id = new Zend_Form_Element_Hidden('id'); $documenttype = new Zend_Form_Element_Text('documenttype'); $documenttype->setAttrib('maxLength', 50); $documenttype->setRequired(true); $documenttype->addValidator('NotEmpty', false, array('messages' => 'Please enter document type.')); $documenttype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document type.'))); $documenttype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_workeligibilitydoctypes', 'field' => 'documenttype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $documenttype->getValidator('Db_NoRecordExists')->setMessage('Document type already exists.'); $issuingauthority = new Zend_Form_Element_Select('issuingauthority'); $issuingauthority->setRegisterInArrayValidator(false); $issuingauthority->setMultiOptions(array('' => 'Select issuing authority', '1' => 'Country', '2' => 'State', '3' => 'City')); $issuingauthority->setRequired(true); $issuingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select issuing authority.')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $documenttype, $issuingauthority, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'payfrequency/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'payfrequency'); $id = new Zend_Form_Element_Hidden('id'); $freqtype = new Zend_Form_Element_Text('freqtype'); $freqtype->setAttrib('maxLength', 20); $freqtype->setLabel("Pay Frequency"); $freqtype->setRequired(true); $freqtype->addValidator('NotEmpty', false, array('messages' => 'Please enter pay frequency type.')); $freqtype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid pay frequency type.'))); $freqtype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_payfrequency', 'field' => 'freqtype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $freqtype->getValidator('Db_NoRecordExists')->setMessage('Pay frequency type already exists.'); $freqshortcode = new Zend_Form_Element_Text('freqcode'); $freqshortcode->setLabel("Short Code"); $freqshortcode->setAttrib('maxLength', 20); $freqshortcode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid pay frequency short code.'))); $freqshortcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_payfrequency', 'field' => 'freqcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $freqshortcode->getValidator('Db_NoRecordExists')->setMessage('Pay frequency short code already exists.'); $description = new Zend_Form_Element_Textarea('freqdescription'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $freqtype, $freqshortcode, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod("POST"); $category = new Zend_Form_Element_Text("name"); $category->setRequired(); $category->setLabel("category Name:"); $category->setAttrib("placeholder", "Enter Category Name"); $category->addValidator(new Zend_Validate_Alnum("true")); $category->setAttrib("class", "form-control"); $category->getDecorator("Label")->setOption("class", "control-label"); $category->getDecorator("Errors")->setOption("class", "alert alert-danger"); $category->getDecorator("Errors")->setOption("role", "alert"); $category->getDecorator("Errors")->setOption("style", " list-style-type:none"); $description = new Zend_Form_Element_Textarea("description"); $description->setLabel('Description:'); $description->setRequired(); $description->setAttrib("rows", "10"); $description->setAttrib("class", "form-control"); $description->getDecorator("Label")->setOption("class", "control-label"); $description->getDecorator("Errors")->setOption("class", "alert alert-danger"); $description->getDecorator("Errors")->setOption("style", " list-style-type:none"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); // $submit->setAttrib("class", "btn"); $this->addElements(array($category, $description, $submit)); }
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->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($options = null) { $this->setName('contact'); $this->setMethod('post'); $this->setAction('/about/contact'); $name = new Zend_Form_Element_Text('name'); $name->setAttrib('size', 35); $name->setLabel('Your Name:'); $name->setRequired(true); $name->addErrorMessage('Please provide your name'); $email = new Zend_Form_Element_Text('email'); $email->setAttrib('size', 35); $email->setLabel('Your E-mail Address:'); $email->setRequired(true); $email->addErrorMessage('Please provide a valid e-mail address'); $email->addValidator('EmailAddress'); $message = new Zend_Form_Element_Textarea('message'); $message->setLabel('Your Message:'); $message->setRequired(true); $message->setAttrib('rows', '10'); $message->setAttrib('cols', '55'); $message->addErrorMessage('Please specify a message'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Send Your Message!'); $this->addElements(array($name, $email, $message, $submit)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalcategory'); $id = new Zend_Form_Element_Hidden('id'); $appraisalcategory = new Zend_Form_Element_Text("category_name"); $appraisalcategory->setLabel('Parameter'); $appraisalcategory->setAttrib('maxLength', 30); $appraisalcategory->addFilter(new Zend_Filter_StringTrim()); $appraisalcategory->setRequired(true); $appraisalcategory->addValidator('NotEmpty', false, array('messages' => 'Please enter parameter.')); $appraisalcategory->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?\',\\/#@$&*()!+]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid parameter.'))); $appraisalcategory->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pa_category', 'field' => 'category_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); $appraisalcategory->getValidator('Db_NoRecordExists')->setMessage('Parameter name already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $appraisalcategory, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { // attribs $this->setAttribs(array('id' => 'form-site-contato')); $this->setMethod('post'); $this->setAction('contato/'); // contato_nome $contato_nome = new Zend_Form_Element_Text('contato_nome'); $contato_nome->setLabel("Nome:"); $contato_nome->setRequired(); $contato_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $contato_nome->setAttrib('class', 'form-control'); $contato_nome->setAttrib('placeholder', 'Informe seu nome'); $contato_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // contato_email $contato_email = new Zend_Form_Element_Text('contato_email'); $contato_email->setLabel("E-mail:"); $contato_email->setRequired(); $contato_email->addErrorMessages(array(Zend_Validate_EmailAddress::INVALID => "Email inválido!")); $contato_email->addValidator('EmailAddress'); $contato_email->setAttrib('class', 'form-control'); $contato_email->setAttrib('placeholder', 'Informe seu email'); $contato_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // contato_mensagem $contato_mensagem = new Zend_Form_Element_Textarea('contato_mensagem'); $contato_mensagem->setLabel("Mensagem:"); $contato_mensagem->setRequired(); $contato_mensagem->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $contato_mensagem->setAttrib('class', 'form-control'); $contato_mensagem->setAttrib('placeholder', 'Digite aqui sua mensagem'); $contato_mensagem->setAttrib('rows', 5); $contato_mensagem->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $this->addElements(array($contato_nome, $contato_email, $contato_mensagem)); parent::init(); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'positions'); $id = new Zend_Form_Element_Hidden('id'); $emptyflag = new Zend_Form_Element_Hidden('emptyFlag'); $positionname = new Zend_Form_Element_Text('positionname'); $positionname->setAttrib('maxLength', 50); $positionname->setRequired(true); $positionname->addValidator('NotEmpty', false, array('messages' => 'Please enter position.')); $positionname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\-\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid position.'))))); $positionname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_positions', 'field' => 'positionname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $positionname->getValidator('Db_NoRecordExists')->setMessage('Position already exists.'); $jobtitleid = new Zend_Form_Element_Select('jobtitleid'); $jobtitleid->setAttrib('class', 'selectoption'); $jobtitleid->setRegisterInArrayValidator(false); $jobtitleid->addMultiOption('', 'Select Job Title'); $jobtitleid->setRequired(true); $jobtitleid->addValidator('NotEmpty', false, array('messages' => 'Please select job title.')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $positionname, $jobtitleid, $description, $emptyflag, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'monthslist/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'monthslist'); $id = new Zend_Form_Element_Hidden('id'); $monthname = new Zend_Form_Element_Select('month_id'); $monthname->setAttrib('class', 'selectoption'); $monthname->setRegisterInArrayValidator(false); $monthname->setRequired(true); $monthname->addValidator('NotEmpty', false, array('messages' => 'Please select month name.')); $monthcode = new Zend_Form_Element_Text('monthcode'); $monthcode->setAttrib('maxLength', 20); $monthcode->addFilter(new Zend_Filter_StringTrim()); $monthcode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_monthslist', 'field' => 'monthcode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $monthcode->getValidator('Db_NoRecordExists')->setMessage('Month code already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'monthslist/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'monthslist\\');'"; $this->addElements(array($id, $monthname, $monthcode, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function 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); parent::__construct(); $account_id = new Zend_Form_Element_Hidden('accountId'); $product_id = new Zend_Form_Element_Hidden('productId'); $newStatus = new Zend_Form_Element_Select('newStatus'); $newStatus->setAttrib('class', 'NormalBtn'); $newStatus->setRequired(true); $newStatus->addMultiOption('', 'Select...'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('class', 'textfield'); $description->setAttrib('rows', '2'); $description->setAttrib('cols', '20'); $description->setRequired(true); $newStatus1 = new Zend_Form_Element_Hidden('newStatus1'); $description1 = new Zend_Form_Element_Hidden('description1'); $submit = new Zend_Form_Element_Submit('Submit'); $submit->setLabel('submit'); $submit->setAttrib('class', 'recurring'); $Confirm = new Zend_Form_Element_Submit('Confirm'); $Confirm->setLabel('Confirm'); $Confirm->setAttrib('class', 'recurring'); $this->addElements(array($submit, $description, $newStatus, $account_id, $product_id, $Confirm, $newStatus1, $description1)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'trainingandcertificationdetails'); $id = new Zend_Form_Element_Hidden('id'); $user_id = new Zend_Form_Element_Hidden('user_id'); //course_name ... $course_name = new Zend_Form_Element_Text('course_name'); $course_name->addFilter(new Zend_Filter_StringTrim()); $course_name->setRequired(true); $course_name->setAttrib('maxLength', 50); $course_name->addValidator('NotEmpty', false, array('messages' => 'Please enter course name.')); $course_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course name.'))))); // course_level... $course_level = new Zend_Form_Element_Text('course_level'); $course_level->addFilter(new Zend_Filter_StringTrim()); $course_level->setRequired(true); $course_level->setAttrib('maxLength', 50); $course_level->addValidator('NotEmpty', false, array('messages' => 'Please enter course level.')); $course_level->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\.\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid course level.'))))); //issued_date $issued_date = new ZendX_JQuery_Form_Element_DatePicker('issued_date'); $issued_date->setOptions(array('class' => 'brdr_none')); $issued_date->setAttrib('readonly', 'true'); $issued_date->setAttrib('onfocus', 'this.blur()'); // description .... $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); //course_offered_by .... $course_offered_by = new Zend_Form_Element_Text('course_offered_by'); $course_offered_by->addFilter(new Zend_Filter_StringTrim()); $course_offered_by->setRequired(true); $course_offered_by->setAttrib('maxLength', 50); $course_offered_by->addValidator('NotEmpty', false, array('messages' => 'Please enter course offered by.')); $course_offered_by->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z0-9\\-\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid name.'))))); //Referer mobile number .... $certification_name = new Zend_Form_Element_Text('certification_name'); $certification_name->addFilter(new Zend_Filter_StringTrim()); $certification_name->setAttrib('maxLength', 50); $certification_name->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-z0-9\\-\\#\\.\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid certification name.'))))); $certificationNameStr = Zend_Controller_Front::getInstance()->getRequest()->getParam('certification_name', null); //If certification is done then should enter the issue date...... if ($certificationNameStr != "") { $issued_date->setRequired(true); $issued_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); } //Form Submit.... $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $user_id, $certification_name, $course_offered_by, $description, $issued_date, $course_level, $course_name, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('issued_date')); }
public function __construct($path) { $fromglcode = new Zend_Form_Element_Select('fromglcode'); $fromglcode->addMultiOption('', 'Select' . '...'); $fromglcode->setAttrib('class', 'selectbutton'); // $fromglcode->setRequired(true) // ->addValidators(array(array('NotEmpty'))); $fromglcode->setAttrib('onchange', 'getglcode(this.value,"' . $path . '")'); $fromglsubcode = new Zend_Form_Element_Select('fromglsubcode'); $fromglsubcode->addMultiOption('', 'Select' . '...'); $fromglsubcode->setAttrib('class', 'selectbutton'); $toglcode = new Zend_Form_Element_Select('toglcode'); $toglcode->addMultiOption('', 'Select' . '...'); $toglcode->setAttrib('class', 'selectbutton'); $toglcode->setRequired(true)->addValidators(array(array('NotEmpty'))); $toglcode->setAttrib('onchange', 'gettoglcode(this.value,"' . $path . '")'); $toglsubcode = new Zend_Form_Element_Select('toglsubcode'); $toglsubcode->addMultiOption('', 'Select' . '...'); $toglsubcode->setAttrib('class', 'selectbutton'); $amount = new Zend_Form_Element_Text('amount'); $amount->setRequired(true)->addValidators(array(array('NotEmpty'))); $amount->setAttrib('class', 'txt_put'); $transactiondate = new Zend_Form_Element_Text('transactiondate'); $transactiondate->setRequired(true)->addValidators(array(array('NotEmpty'))); $transactiondate->setAttrib('class', 'txt_put'); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('class', 'textfield'); $description->setAttrib('rows', '1'); $description->setAttrib('cols', '20'); $description->setAttrib('id', 'description'); $description->setRequired(true); $officeType = new Zend_Form_Element_Select('officeType'); $officeType->addMultiOption('', 'Select' . '...'); $officeType->setAttrib('class', 'selectbutton'); $officeType->setRequired(true)->addValidators(array(array('NotEmpty'))); $officeType->setAttrib('onchange', 'getBranch(this.value,"' . $path . '")'); $subOffice = new Zend_Form_Element_Select('subOffice'); $subOffice->addMultiOption('', 'Select' . '...'); $subOffice->setAttrib('class', 'selectbutton'); $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); $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('Submit'); $submit->setAttrib('class', 'officesubmit'); $this->addElements(array($fromglcode, $fromglsubcode, $toglcode, $toglsubcode, $amount, $transactiondate, $description, $submit, $officeType, $subOffice, $paymenttype, $no)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'managerleaverequest'); $id = new Zend_Form_Element_Hidden('id'); $appliedleavesdaycount = new Zend_Form_Element_Text('appliedleavesdaycount'); $appliedleavesdaycount->setAttrib('readonly', 'true'); $appliedleavesdaycount->setAttrib('onfocus', 'this.blur()'); $employeename = new Zend_Form_Element_Text('employeename'); $employeename->setAttrib('readonly', 'true'); $employeename->setAttrib('onfocus', 'this.blur()'); $managerstatus = new Zend_Form_Element_Select('managerstatus'); $managerstatus->setRegisterInArrayValidator(false); $managerstatus->setMultiOptions(array('1' => 'Approve', '2' => 'Reject')); $comments = new Zend_Form_Element_Textarea('comments'); $comments->setLabel("Comments"); $comments->setAttrib('rows', 10); $comments->setAttrib('cols', 50); $comments->setAttrib('maxlength', '200'); $leavetypeid = new Zend_Form_Element_Select('leavetypeid'); $leavetypeid->setAttrib('class', 'selectoption'); $leavetypeid->setRegisterInArrayValidator(false); $leavetypeid->setAttrib('readonly', 'true'); $leavetypeid->setAttrib('onfocus', 'this.blur()'); $leaveday = new Zend_Form_Element_Select('leaveday'); $leaveday->setRegisterInArrayValidator(false); $leaveday->setMultiOptions(array('1' => 'Full Day', '2' => 'Half Day')); $leaveday->setAttrib('readonly', 'true'); $leaveday->setAttrib('onfocus', 'this.blur()'); $from_date = new Zend_Form_Element_Text('from_date'); $from_date->setAttrib('readonly', 'true'); $from_date->setAttrib('onfocus', 'this.blur()'); $to_date = new Zend_Form_Element_Text('to_date'); $to_date->setAttrib('readonly', 'true'); $to_date->setAttrib('onfocus', 'this.blur()'); $reason = new Zend_Form_Element_Textarea('reason'); $reason->setAttrib('rows', 10); $reason->setAttrib('cols', 50); $reason->setAttrib('maxlength', '400'); $reason->setAttrib('readonly', 'true'); $reason->setAttrib('onfocus', 'this.blur()'); $leavestatus = new Zend_Form_Element_Text('leavestatus'); $leavestatus->setAttrib('readonly', 'true'); $leavestatus->setAttrib('onfocus', 'this.blur()'); $createddate = new Zend_Form_Element_Text('createddate'); $createddate->setAttrib('readonly', 'true'); $createddate->setAttrib('onfocus', 'this.blur()'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $employeename, $managerstatus, $comments, $reason, $leaveday, $from_date, $to_date, $leavetypeid, $appliedleavesdaycount, $leavestatus, $createddate, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'roles'); $id = new Zend_Form_Element_Hidden('id'); $rolename = new Zend_Form_Element_Text('rolename'); $rolename->setAttrib('maxLength', 50); $rolename->setAttrib('title', 'Role name'); $rolename->addFilter(new Zend_Filter_StringTrim()); $rolename->setRequired(true); $rolename->addValidator('NotEmpty', false, array('messages' => 'Please enter role name.')); $rolename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid role name.'))); $rolename->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'rolename', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive!=0'))); $rolename->getValidator('Db_NoRecordExists')->setMessage('Role name already exists.'); $rolename->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role name must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role name must contain at least %min% characters.'))))); $roletype = new Zend_Form_Element_Text('roletype'); $roletype->setRequired(true); $roletype->setAttrib('maxLength', 25); $roletype->setAttrib('title', 'Role type'); $roletype->addFilter(new Zend_Filter_StringTrim()); $roletype->addValidator('NotEmpty', false, array('messages' => 'Please enter role type.')); $roletype->addValidator("regex", true, array('pattern' => '/^[a-zA-Z]+?$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $roletype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'roletype', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0'))); $roletype->getValidator('Db_NoRecordExists')->setMessage('Role type already exists.'); $roletype->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 25, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role type must contain at least %min% characters.'))))); $roledescription = new Zend_Form_Element_Textarea('roledescription'); $roledescription->setAttrib('rows', 10); $roledescription->setAttrib('cols', 50); $roledescription->setAttrib('maxlength', '100'); $roledescription->setAttrib('title', 'Role description'); $levelid = new Zend_Form_Element_Hidden('levelid'); $levelid->addFilter(new Zend_Filter_StringTrim()); $levelid->setRequired(true); $levelid->addValidator('NotEmpty', false, array('messages' => 'Please select level.')); $istimeActive = Zend_Controller_Front::getInstance()->getRequest()->getParam('istimeactive'); $prev_cnt = new Zend_Form_Element_Hidden('prev_cnt'); $prev_cnt->setRequired(true); if ($istimeActive) { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges other than time management.')); } else { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges.')); } $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'roles/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'roles\\');'"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $rolename, $roletype, $roledescription, $levelid, $submit, $prev_cnt)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'currencyconverter'); $id = new Zend_Form_Element_Hidden('id'); $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $basecurrency = new Zend_Form_Element_Select('basecurrency'); $basecurrency->setAttrib('class', 'selectoption'); $basecurrency->addMultiOption('', 'Select base currency'); $basecurrency->setAttrib('onchange', 'displayTargetCurrency(this)'); $basecurrency->setRegisterInArrayValidator(false); $basecurrency->setRequired(true); $basecurrency->addValidator('NotEmpty', false, array('messages' => 'Please select base currency.')); $targetcurrency = new Zend_Form_Element_Select('targetcurrency'); $targetcurrency->setAttrib('class', 'selectoption'); $targetcurrency->addMultiOption('', 'Select target currency'); $targetcurrency->setRegisterInArrayValidator(false); $targetcurrency->setRequired(true); $targetcurrency->addValidator('NotEmpty', false, array('messages' => 'Please select target currency.')); if ($id_val == '') { $targetcurrency->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currencyconverter', 'field' => 'targetcurrency', 'exclude' => 'basecurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('basecurrency') . '" AND targetcurrency="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('targetcurrency') . '" and isactive=1'))); $targetcurrency->getValidator('Db_NoRecordExists')->setMessage('Currency combination already exists.'); } $exchangerate = new Zend_Form_Element_Text("exchangerate"); $exchangerate->setAttrib('maxLength', 15); $exchangerate->addFilter(new Zend_Filter_StringTrim()); $exchangerate->setRequired(true); $exchangerate->addValidator('NotEmpty', false, array('messages' => 'Please enter exchange rate.')); $exchangerate->addValidator("regex", false, array("/^[0-9]+(\\.[0-9]{1,6})?\$/", "messages" => "Please enter valid exchange rate.")); $start_date = new ZendX_JQuery_Form_Element_DatePicker('start_date'); $start_date->setAttrib('readonly', 'true'); $start_date->setAttrib('onfocus', 'this.blur()'); $start_date->setOptions(array('class' => 'brdr_none')); $start_date->setRequired(true); $start_date->addValidator('NotEmpty', false, array('messages' => 'Please select start date.')); $end_date = new ZendX_JQuery_Form_Element_DatePicker('end_date'); $end_date->setAttrib('readonly', 'true'); $end_date->setAttrib('onfocus', 'this.blur()'); $end_date->setOptions(array('class' => 'brdr_none')); $end_date->setRequired(true); $end_date->addValidator('NotEmpty', false, array('messages' => 'Please select end 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, $basecurrency, $targetcurrency, $exchangerate, $start_date, $end_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('start_date', 'end_date')); }
public function init() { $remarks = new Zend_Form_Element_Textarea('remarks'); $remarks->setAttrib('class', 'textfield'); $remarks->setAttrib('id', 'remarks'); $remarks->setAttrib('rows', '2'); $remarks->setAttrib('cols', '20'); $remarks->setRequired(true)->addValidators(array(array('NotEmpty'))); $submit_yes = new Zend_Form_Element_Submit('Yes'); $submit_yes->setAttrib('id', 'Yes'); $this->addElements(array($remarks, $submit_yes)); }