本文整理汇总了PHP中Zend_Form_Element_Submit::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Submit::setRequired方法的具体用法?PHP Zend_Form_Element_Submit::setRequired怎么用?PHP Zend_Form_Element_Submit::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Submit
的用法示例。
在下文中一共展示了Zend_Form_Element_Submit::setRequired方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor to build the form
*/
public function __construct($options = NULL)
{
parent::__construct($options);
$this->setName('Login form');
$username = new Zend_Form_Element_Text('username');
$username->setLabel('Username')->setAttrib('class', 'text')->setRequired(TRUE)->addFilters(array('StripTags', 'StringTrim'))->addValidator('notEmpty');
$passwort = new Zend_Form_Element_Password('passwort');
$passwort->setLabel('Password')->setAttrib('class', 'text')->setRequired(TRUE);
$strategy = new Zend_Form_Element_Hidden('strategy');
$strategy->setValue('db');
$submit = new Zend_Form_Element_Submit('login');
$submit->setRequired(FALSE)->setIgnore(TRUE)->setLabel('Login');
$this->addElements(array($username, $passwort, $strategy, $submit));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')), array('Description', array('tag' => 'p', 'class' => 'error', 'placement' => 'prepend')), 'Form'));
}
示例2: __construct
public function __construct($path, $minumumbal, $maximumbal)
{
parent::__construct($path, $minumumbal);
$date1 = new ZendX_JQuery_Form_Element_DatePicker('date1');
$date1->setAttrib('class', 'txt_put');
$date1->setAttrib('autocomplete', 'off');
$date1->setJQueryParam('dateFormat', 'yy-mm-dd');
$date1->setRequired(true);
$period = new Zend_Form_Element_Select('period');
$period->addMultiOption('', 'Select...');
$period->setAttrib('class', 'txt_put');
$period->setRequired(true);
$period->setAttrib('onchange', 'getInterests("' . $path . '",this.value)');
$interest = new Zend_Form_Element_Text('interest');
$interest->setAttrib('class', 'txt_put');
// $interest->setAttrib('readonly', 'true');
$tAmount = new Zend_Form_Element_Text('tAmount');
$tAmount->setAttrib('class', 'txt_put');
$tAmount->setAttrib('onchange', 'calculateMatureAmount()');
$valid = new Zend_Validate_Between(array('min' => $minumumbal, 'max' => $maximumbal));
$tAmount->addValidators(array(array($valid, true)));
$matureamount = new Zend_Form_Element_Text('matureamount');
$matureamount->setAttrib('class', 'txt_put');
$amount = new Zend_Form_Element_Text('amount');
$amount->setAttrib('class', 'txt_put');
// $amount->setRequired(true);
$amount->setAttrib('onchange', 'calculateTotalAmount(this.value),calculateMatureAmount()');
$memberfirstname = new Zend_Form_Element_MultiCheckbox('memberfirstname');
$memberfirstname->setAttrib('class', 'textfield');
// $memberfirstname->setRequired(true);
$fixedfee = new Zend_Form_Element_Text('fixedfee');
$fixedfee->setAttrib('class', 'txt_put');
$fixedfee->setAttrib('readonly', 'true');
$totalamount = new Zend_Form_Element_Text('totalamount');
$totalamount->setAttrib('class', 'txt_put');
$totalamount->setAttrib('readonly', 'true');
$memberId = new Zend_Form_Element_Hidden('memberId');
$productId = new Zend_Form_Element_Hidden('Id');
$membercode = new Zend_Form_Element_Hidden('code');
$typeId = new Zend_Form_Element_Hidden('typeId');
$Type = new Zend_Form_Element_Hidden('Type');
$memberTypeIdv = new Zend_Form_Element_Hidden('memberTypeIdv');
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setRequired(false);
$Yes = new Zend_Form_Element_Submit('Yes');
$back = new Zend_Form_Element_Submit('Back');
$this->addElements(array($submit, $amount, $period, $matureamount, $interest, $tAmount, $memberfirstname, $fixedfee, $memberId, $membercode, $totalamount, $Type, $date1, $productId, $typeId, $memberTypeIdv, $Yes, $back));
}
示例3: memberForm
public function memberForm($elements)
{
parent::__construct($elements);
$this->setName('Search');
$ZendTranslate = Zend_Registry::get('Zend_Translate');
foreach ($elements as $ele) {
foreach ($ele as $key => $val) {
//add element and set validation
if ($ele['type'] == 'Text') {
$grantname = new Zend_Form_Element_Text($ele['name']);
$grantname->setAttrib('class', 'txt_put');
} else {
if ($ele['type'] == 'Select') {
$grantname = new Zend_Form_Element_Select($ele['name']);
$grantname->setAttrib('class', 'selectbutton');
$grantname->addMultiOption('', $ZendTranslate->_('select') . '...');
} else {
if ($ele['type'] == 'Hidden') {
$grantname = new Zend_Form_Element_Hidden($ele['name']);
} else {
if ($ele['type'] == 'Submit') {
$grantname = new Zend_Form_Element_Submit($ele['name']);
if ($ele['name'] == 'Search') {
$grantname->setAttrib('class', 'primaryAction');
$grantname->setAttrib('id', 'submit-wf_TestForm');
} else {
$grantname->setAttrib('class', 'officesubmit');
}
}
}
}
}
if ($ele['Required'] == 'true') {
$grantname->setRequired(true);
}
//add elements to form
$this->addElements(array($grantname));
}
}
return $this;
}
示例4: init
public function init()
{
$form = new Zend_Form("form");
$form->setMethod('post');
$title = new Zend_Form_Element_Text("title");
$title->setLabel("Title:");
$title->setAttrib("placeholder", "Title");
$title->setAttrib("class", "form-control");
$title->setRequired();
$picture = new Zend_Form_Element_File("picture");
$picture->setLabel("Image:");
$picture->setDestination('/var/www/html/RNR/public/images/tocategory');
$picture->setRequired();
$submit = new Zend_Form_Element_Submit("submit");
$submit->setAttrib("class", "btn btn-primary");
$submit->setLabel("Save");
$submit->setRequired();
$rest = new Zend_Form_Element_Reset('Reset');
$rest->setAttrib("class", "btn btn-info");
$id = new Zend_Form_Element_Hidden("id");
$this->addElements(array($title, $picture, $submit, $rest, $id));
}
示例5: init
function init()
{
// Set the method for the display form to POST
$this->setMethod('post');
$this->setAction(WEBROOT . 'statistics');
$this->addAttribs(array('id' => 'filterComplexForm', 'class' => ''));
$this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
//BEGIN:Id Category Expenses
$idCategoryE = new Zend_Form_Element_Multiselect('idCategoryE');
$options = array('1' => strtoupper(Zend_Registry::get('translate')->_('admin_expenses')));
$categories = new Default_Model_Groups();
$select = $categories->getMapper()->getDbTable()->select()->where('NOT deleted')->where('type=?', 0)->order('name ASC');
$result = $categories->fetchAll($select);
if (NULL != $result) {
foreach ($result as $value) {
$options[$value->getId()] = $value->getName();
}
}
$idCategoryE->setMultiOptions($options);
$idCategoryE->addValidator(new Zend_Validate_InArray(array_keys($options)));
$idCategoryE->setAttribs(array('class' => 'rightAdd form_selector', 'id' => 'idCategoryE'));
$idCategoryE->setRequired(false);
$this->addElement($idCategoryE);
//END:Id Category Expenses
//BEGIN:Id Category Income
$idCategoryI = new Zend_Form_Element_Multiselect('idCategoryI');
$options = array('2' => strtoupper(Zend_Registry::get('translate')->_('admin_income')));
$categories = new Default_Model_Groups();
$select = $categories->getMapper()->getDbTable()->select()->where('NOT deleted')->where('type=?', 1)->order('name ASC');
$result = $categories->fetchAll($select);
if (NULL != $result) {
foreach ($result as $value) {
$options[$value->getId()] = " " . $value->getName();
}
}
$idCategoryI->setMultiOptions($options);
$idCategoryI->addValidator(new Zend_Validate_InArray(array_keys($options)));
$idCategoryI->setAttribs(array('class' => 'rightAdd form_selector', 'id' => 'idCategoryI'));
$idCategoryI->setRequired(false);
$this->addElement($idCategoryI);
//END:Id Category Income
//BEGIN:Timeframe
$timeframe = new Zend_Form_Element_Select('timeframe');
$options = array('m' => Zend_Registry::get('translate')->_('admin_monthly'), 'w' => Zend_Registry::get('translate')->_('admin_weekly'), 'd' => Zend_Registry::get('translate')->_('admin_daily'));
$timeframe->setMultiOptions($options);
$timeframe->addValidator(new Zend_Validate_InArray(array_keys($options)));
$timeframe->setAttribs(array('class' => 'rightAdd validate[required] form_selector', 'id' => 'timeframe'));
$timeframe->setRequired(true);
$timeframe->setValue('m');
$this->addElement($timeframe);
//END:Timeframe
// BEGIN: data
$dataStart = new Zend_Form_Element_Text('dataStartC');
$dataStart->setAttribs(array('class' => 'data_inceput_c validate[required]', 'placeholder' => Zend_Registry::get('translate')->_('admin_from_date')));
$dataStart->setRequired(true);
$this->addElement($dataStart);
$dataEnd = new Zend_Form_Element_Text('dataEndC');
$dataEnd->setAttribs(array('class' => 'data_sfarsit_c validate[required]', 'placeholder' => Zend_Registry::get('translate')->_('admin_to_date')));
$this->addElement($dataEnd);
// END: data
$submit = new Zend_Form_Element_Submit('submitC');
$submit->setValue(Zend_Registry::get('translate')->_('admin_menu_form_search'));
$submit->setAttribs(array('class' => 'submit'));
$submit->setRequired(true);
$this->addElement($submit);
$submitReportE = new Zend_Form_Element_Submit('submitReportE');
$submitReportE->setAttribs(array('class' => 'submitReport'));
$submitReportE->setRequired(true);
$this->addElement($submitReportE);
$submitReportI = new Zend_Form_Element_Submit('submitReportI');
$submitReportI->setAttribs(array('class' => 'submitReport'));
$submitReportI->setRequired(true);
$this->addElement($submitReportI);
}