本文整理汇总了PHP中Zend_Form_Element_Textarea::setAllowEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Textarea::setAllowEmpty方法的具体用法?PHP Zend_Form_Element_Textarea::setAllowEmpty怎么用?PHP Zend_Form_Element_Textarea::setAllowEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Textarea
的用法示例。
在下文中一共展示了Zend_Form_Element_Textarea::setAllowEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($options = null, $data = null, $lang = 'en', $contentType = 'problem')
{
parent::__construct($options);
$translate = Zend_Registry::get('Zend_Translate');
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
$this->setDisableLoadDefaultDecorators(true);
$this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->removeDecorator('DtDdWrapper');
$this->setName('add_content_form');
//$this->setName('contentAdd');
$this->setAction($baseUrl . '/' . $lang . '/content/add/' . $contentType);
$this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
$this->setAttrib('enctype', 'multipart/form-data');
/**
*
* Form Elements
*
*/
// Language, Select
$language = new Zend_Form_Element_Select('content_language');
$language->addFilter('StringtoLower')->setLabel($translate->_("content-add-language"))->setRequired(true)->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['languages']);
// Header, input
$header = new Zend_Form_Element_Text('content_header');
$header->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setDescription($translate->_("content-add-headline-help-text"))->setLabel($translate->_("content-add-header"))->setDecorators(array('FormElementDecorator'));
// Keywords, input
$keywords = new Zend_Form_Element_Text('content_keywords');
$keywords->addFilter('StringToLower')->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long'))), array('Regex', true, array('/^[\\p{L}0-9, ]*$/'))))->setLabel($translate->_("content-add-keywords"))->setDescription($translate->_("content-add-keywords-help-text"))->setDecorators(array('FormElementDecorator'));
// Content type, Hidden
$content_type = new Zend_Form_Element_Hidden('content_type');
$content_type->setValue($data['content_type'])->setDecorators(array('FormHiddenElementDecorator'));
// Used for track button clicks
$hidden_content_publish = new Zend_Form_Element_Hidden('content_publish');
$hidden_content_publish->setDecorators(array('FormHiddenElementDecorator'));
$hidden_content_save = new Zend_Form_Element_Hidden('content_save');
$hidden_content_save->setDecorators(array('FormHiddenElementDecorator'));
// Related content, Hidden
$content_relatesto_id = new Zend_Form_Element_Hidden('content_relatesto_id');
$content_relatesto_id->setValue($data['content_relatesto_id'])->setDecorators(array('FormHiddenElementDecorator'));
// Lead, Textarea
$textlead = new Zend_Form_Element_Textarea('content_textlead');
$textlead->setRequired(true)->setAttrib('class', 'textlead')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 320, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-textlead"))->setDescription($translate->_("content-add-textlead-help-text"))->setDecorators(array('FormElementDecorator'));
// Body, Textarea
$text = new Zend_Form_Element_Textarea('content_text');
$text->setAllowEmpty(true)->setAttrib('class', 'textbody')->addValidators(array(array('StringLength', true, array(0, 4000, 'messages' => array('stringLengthTooShort' => 'content-add-field-too-short', 'stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-text"))->setDescription($translate->_('content-add-' . $contentType . '-textbody-help-text'))->setDecorators(array('FormOptionalElementDecorator'));
// Related companies, Input
$related_companies = new Zend_Form_Element_Text('content_related_companies');
$related_companies->setRequired(false)->addValidators(array(array('StringLength', true, array(0, 120, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-related_companies"))->setDescription($translate->_("content-add-related_companies-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
// Problem research question, Input
$research = new Zend_Form_Element_Text('content_research');
$research->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-research"))->setDescription($translate->_("content-add-research-help-text"))->setDecorators(array('FormElementDecorator'));
// Future info opportunity, Input
$opportunity = new Zend_Form_Element_Text('content_opportunity');
$opportunity->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-opportunity"))->setDescription($translate->_("content-add-opportunity-help-text"))->setDecorators(array('FormElementDecorator'));
// Future info threat, Input
$threat = new Zend_Form_Element_Text('content_threat');
$threat->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-threat"))->setDescription($translate->_("content-add-threat-help-text"))->setDecorators(array('FormElementDecorator'));
// Idea/solution in one sentence, Input
$solution = new Zend_Form_Element_Text('content_solution');
$solution->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-solution"))->setDecorators(array('FormElementDecorator'));
// File upload, File
$file = new Zend_Form_Element_File('content_file_upload');
$file->setDestination('../www/upload')->removeDecorator('DtDdWrapper')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'png,gif,jpg,jpeg,doc,zip,xls,mpp,pdf,wmv,avi,mkv,mov,mpeg,mp4,divx,flv,ogg,3gp');
$file->setLabel($translate->_("content-add-upload-file"))->setDescription($translate->_("content-add-file-upload-help-text"))->setDecorators(array('UploadDecorator'))->setAttrib("onchange", "multiFile(this, '" . $translate->_("content-add-file-delete-file-button") . "');");
// References, Textarea
$references = new Zend_Form_Element_Textarea('content_references');
$references->setAttrib('class', 'textlead')->addValidators(array(array('StringLength', true, array(0, 2000, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-references"))->setDescription($translate->_("content-add-references-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
/*
// Future info classification, Select
$finfoClasses = new Zend_Form_Element_Select('content_finfo_class');
$finfoClasses->addFilter('StringtoLower')
->setLabel($translate->_("content-add-finfo-classification"))
->setDecorators(array('FormElementDecorator'))
->setMultiOptions($data['FutureinfoClasses']);
// Industry, Select
$industry = new Zend_Form_Element_Select('content_industry');
$industry->addFilter('StringtoLower')
->setLabel($translate->_("content-view-industry-classification"))
->setDecorators(array('FormElementDecorator'))
// This should probably be converted to use jquery
->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/division/industry/'+this.value,
'content_division_div', this.value);")
->setMultiOptions($data['Industries']);
// Division, Select
$division = new Zend_Form_Element_Select('content_division');
$division->addFilter('StringtoLower')
->setDecorators(array('FormElementDecorator'))
->setMultiOptions($data['Divisions'])
->setRegisterInArrayValidator(false);
// Group, Select
$group = new Zend_Form_Element_Select('content_group');
$group->addFilter('StringtoLower')
->setDecorators(array('FormElementDecorator'))
->setMultiOptions($data['Groups'])
->setRegisterInArrayValidator(false);
// Class, Select
$class = new Zend_Form_Element_Select('content_class');
//.........这里部分代码省略.........
示例2: _initEmailText
/**
* @return EngineBlock_Form_EmailConfiguration
*/
public function _initEmailText()
{
$element = new Zend_Form_Element_Textarea('email_text');
$element->setAllowEmpty(false);
return $this->addElement($element);
}