本文整理汇总了PHP中Zend_Form::setMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::setMethod方法的具体用法?PHP Zend_Form::setMethod怎么用?PHP Zend_Form::setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::setMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEmptyFormNameShouldNotRenderEmptyFormId
public function testEmptyFormNameShouldNotRenderEmptyFormId()
{
$form = new Zend_Form();
$form->setMethod('post')->setAction('/foo/bar')->setView($this->getView());
$html = $form->render();
$this->assertNotContains('id=""', $html, $html);
}
示例2: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$category_name = new Zend_Form_Element_Text('category_name');
$category_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên danh mục không được để trống'));
/*
$category_parent_id = new Zend_Form_Element_Select('category_parent_id');
$category_parent_id->addMultiOption('', '0');
foreach($this->mDanhmuc->getListDM() as $item)
{
$category_parent_id->addMultiOption($item['category_name'], $item['category_id']);
}
*/
$is_active = $form->createElement("select","is_active",array(
"label" => "Kích hoạt",
"multioptions"=> array(
"0" => "Chưa kích hoạt",
"1" => "Đã kích hoạt")));
$category_name->removeDecorator('HtmlTag')->removeDecorator('Label');
$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($category_name,$is_active));
return $form;
}
示例3: setForm
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;
}
示例4: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$image_name = new Zend_Form_Element_Text('image_name');
$image_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên ảnh không được để trống'));
$image_link = new Zend_Form_Element_Textarea('image_link');
$image_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Hình ảnh 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"));
$image_name->removeDecorator('HtmlTag')->removeDecorator('Label');
$image_link->removeDecorator('HtmlTag')->removeDecorator('Label');
$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($image_name,$image_link,$is_active));
return $form;
}
示例5: form
function form()
{
if (!isset($this->form)) {
$form = new Zend_Form();
$form->setAction($this->url());
$form->setMethod('post');
// Create and configure username element:
$username = $form->createElement('text', 'username');
$username->setLabel("Username");
$username->addValidator('alnum');
$username->addValidator('regex', false, array('/^[a-z]+/'));
$username->addValidator('stringLength', false, array(6, 20));
$username->setRequired(true);
$username->addFilter('StringToLower');
// Create and configure password element:
$password = $form->createElement('password', 'password');
$password->setLabel("Password");
$password->addValidator('StringLength', false, array(6));
$password->setRequired(true);
// Add elements to form:
$form->addElement($username);
$form->addElement($password);
// use addElement() as a factory to create 'Login' button:
$form->addElement('submit', 'login', array('label' => 'Login'));
// Since we're using this outside ZF, we need to supply a default view:
$form->setView(new Zend_View());
$this->form = $form;
}
return $this->form;
}
示例6: ajouterAction
public function ajouterAction()
{
$form = new Zend_Form();
$form->setMethod('post');
$form->addElement('text', 'TITRE_E', array('label' => 'Titre de l\'émission : ', 'required' => true, 'filters' => array('StringTrim')));
$form->addElement('text', 'THEME', array('label' => 'Theme : ', 'required' => true, 'filters' => array('StringTrim')));
$form->addElement('text', 'ANIMATEURS', array('label' => 'Animateur(s) : ', 'required' => true, 'filters' => array('StringTrim')));
$form->addElement('text', 'DUREE', array('label' => 'Durée de l\'émission : ', 'required' => true, 'filters' => array('Int')));
$form->addElement('text', 'PATH_E', array('label' => 'Lien vers le podcast : ', 'required' => false, 'filters' => array('StringTrim')));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Ajouter');
$form->addElement($submit);
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
$dba = Zend_Registry::get('dba');
$datas = array('THEME' => $formData["THEME"], 'ANIMATEURS' => $formData["ANIMATEURS"], 'DUREE' => $formData["DUREE"], 'TITRE_E' => $formData["TITRE_E"], 'PATH_E' => $formData["PATH_E"]);
$dba->beginTransaction();
try {
$dba->insert('EMISSION', $datas);
$dba->commit();
} catch (Exception $e) {
$dba->rollBack();
echo $e->getMessage();
}
$this->_helper->redirector('index');
} else {
$form->populate($formData);
}
}
$this->view->form = $form;
}
示例7: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$youtube_username = new Zend_Form_Element_Text('youtube_username');
$youtube_username->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên tài khoản không được để trống'));
$password = new Zend_Form_Element_Text('password');
$password->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống'));
$youtube_gallery = new Zend_Form_Element_Text('youtube_gallery');
$youtube_gallery->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên album không được để trống'));
$is_selected = $form->createElement("select","is_selected",array(
"label" => "Kích hoạt",
"multioptions"=> array(
"0" => "Không",
"1" => "Có")));
$youtube_username->removeDecorator('HtmlTag')->removeDecorator('Label');
$password->removeDecorator('HtmlTag')->removeDecorator('Label');
$youtube_gallery->removeDecorator('HtmlTag')->removeDecorator('Label');
$is_selected->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($youtube_username,$password,$youtube_gallery,$is_selected));
return $form;
}
示例8: createAssetstoreForm
/** Create assetstore form */
public function createAssetstoreForm()
{
$form = new Zend_Form();
$action = $this->webroot . '/assetstore/add';
$form->setAction($action);
$form->setName('assetstoreForm');
$form->setMethod('post');
$form->setAttrib('class', 'assetstoreForm');
// Name of the assetstore
$inputDirectory = new Zend_Form_Element_Text('name', array('label' => $this->t('Give a name'), 'id' => 'assetstorename'));
$inputDirectory->setRequired(true);
$form->addElement($inputDirectory);
// Input directory
$basedirectory = new Zend_Form_Element_Text('basedirectory', array('label' => $this->t('Pick a base directory'), 'id' => 'assetstoreinputdirectory'));
$basedirectory->setRequired(true);
$form->addElement($basedirectory);
// Assetstore type
$assetstoretypes = array('0' => $this->t('Managed by MIDAS'), '1' => $this->t('Remotely linked'));
// Amazon support is not yet implemented, don't present it as an option
// '2' => $this->t('Amazon S3'));
$assetstoretype = new Zend_Form_Element_Select('assetstoretype', array('id' => 'assetstoretype'));
$assetstoretype->setLabel('Select a type')->setMultiOptions($assetstoretypes);
// Add a loading image
$assetstoretype->setDescription('<div class="assetstoreLoading" style="display:none"><img src="' . $this->webroot . '/core/public/images/icons/loading.gif"/></div>')->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'dd')), array('Label', array('tag' => 'dt')), 'Errors'));
$form->addElement($assetstoretype);
// Submit
$addassetstore = new Zend_Form_Element_Submit('addassetstore', $this->t('Add this assetstore'));
$form->addElement($addassetstore);
return $form;
}
示例9: getForm
public function getForm()
{
$form = new Zend_Form();
$form->setMethod('post');
$form->setDecorators(array(array('ViewScript', array('viewScript' => 'reports/report5Form.phtml'))));
$items = $this->getPeriodItems('REQ_MOZ_CONTMOVEMENT_YEAR_SPEC');
$e = new Zend_Form_Element_Select('period', array('label' => 'Рік', 'multiOptions' => $items, 'required' => true, 'style' => 'width: 80px'));
$form->addElement($e);
$items = $this->getGuideItems('T_REPORTPLANKIND');
$e = new Zend_Form_Element_Select('reportplankind', array('label' => 'Звіт/план', 'multiOptions' => $items, 'required' => true, 'style' => 'width: 200px'));
$form->addElement($e);
$items = $this->getGuideItems('T_EDUFORM', false);
$e = new Zend_Form_Element_Select('eduform', array('label' => 'Форма навчання', 'multiOptions' => $items, 'style' => 'width: 200px'));
$form->addElement($e);
$items = $this->getGuideItems('T_EDUBASIS', false);
$e = new Zend_Form_Element_Select('edubase', array('label' => 'Форма фінансування', 'multiOptions' => $items, 'style' => 'width: 200px'));
$form->addElement($e);
$items = $this->getGuideItems('T_COUNTRYTYPE', true);
$e = new Zend_Form_Element_Select('countrytype', array('label' => 'Тип громадянства', 'multiOptions' => $items, 'style' => 'width: 200px'));
$form->addElement($e);
if (@(!$this->params['establishment'])) {
$e = new Zend_Form_Element_Checkbox('indpapers', array('label' => 'Індивідуальні аркуші'));
$form->addElement($e);
}
$refreshAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'page', 'action' => 'show'));
$e = new Zend_Form_Element_Submit('refresh', array('label' => 'Обновити', 'onclick' => "document.forms[0].action='{$refreshAct}'"));
$form->addElement($e);
$excelAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'reports', 'action' => 'excel', 'report' => 5));
$e = new Zend_Form_Element_Submit('excel', array('label' => 'Excel', 'onclick' => "document.forms[0].action='{$excelAct}'"));
$form->addElement($e);
$form->setElementDecorators(array('ViewHelper', 'Errors'));
return $form;
}
示例10: getAddContentForm
public function getAddContentForm($submitLabel, $contentTitle = null, $contentDescription = null)
{
$database = Zend_Db_Table::getDefaultAdapter();
$content = $database->select()->from('content')->order('content_id DESC')->query()->fetch();
$imageName = $content['content_id'] + 1;
$form = new Zend_Form();
$form->setMethod('post');
if ($submitLabel == 'Add Content!') {
$form->setAttrib('enctype', 'multipart/form-data');
$image = new Zend_Form_Element_File('foo');
$image->setLabel('Upload an image:')->setDestination('../images');
$image->addFilter('Rename', array('target' => $imageName . '.jpg', 'overwrite' => TRUE));
$image->addValidator('Count', false, 1);
$image->addValidator('Extension', false, 'jpg,png,gif');
$form->addElement($image, 'foo');
}
$title = $form->createElement('text', 'title');
$title->setRequired(true);
$title->setValue($contentTitle);
$title->setLabel('Title');
$form->addElement($title);
$description = $form->createElement('textarea', 'description', array('rows' => 10));
$description->setRequired(true);
$description->setValue($contentDescription);
$description->setLabel('Description');
$form->addElement($description);
$form->addElement('submit', 'submit', array('label' => $submitLabel));
return $form;
}
示例11: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$ads_banner = new Zend_Form_Element_Textarea('ads_banner');
$ads_banner->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Biểu ngữ không được để trống'));
$ads_position = new Zend_Form_Element_Text('ads_position');
$ads_position->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vị trí không được để trống'));
$ads_name = new Zend_Form_Element_Text('ads_name');
$ads_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên quảng cáo không được để trống'));
$ads_link = new Zend_Form_Element_Text('ads_link');
$ads_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Đường dẫn không được để trống'));
$ads_position = $form->createElement("select","ads_position",array(
"label" => "Vị trí",
"multioptions"=> array(
"1" => "Trên",
"2" => "Giữa",
"3" => "Trái",
"4" => "Phải",
"5" => "Nội dung")));
$ads_banner->removeDecorator('HtmlTag')->removeDecorator('Label');
$ads_position->removeDecorator('HtmlTag')->removeDecorator('Label');
$ads_name->removeDecorator('HtmlTag')->removeDecorator('Label');
$ads_link->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($ads_banner,$ads_position,$ads_name,$ads_link));
return $form;
}
示例12: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$user_login = new Zend_Form_Element_Text('user_login');
$user_login->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên đăng nhập không được để trống'));
$user_pass = new Zend_Form_Element_Password('user_pass');
$user_pass->setAttrib('renderPassword', true);
$user_pass->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống'));
$user_fullname = new Zend_Form_Element_Text('user_fullname');
$user_fullname->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên người dùng không được để trống'));
$user_email = new Zend_Form_Element_Text('user_email');
$user_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ'));
$user_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Email không được để trống'));
$user_address = new Zend_Form_Element_Text('user_address');
$user_address->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Địa chỉ không được để trống'));
$user_login->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_pass->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_fullname->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_email->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_address->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($user_login,$user_pass,$user_fullname,$user_email,$user_address));
return $form;
}
示例13: removeAction
public function removeAction()
{
$form = new Zend_Form();
$form->setView(new Zend_View());
$form->setMethod('post');
$form->setAction('');
$form->setAttrib('class', 'devel');
$form->setAttrib('title', 'Remove wizard - ' . $this->getRequest()->getParam('name'));
$handleOptions = explode(',', $this->getRequest()->getParam('handles'));
$referenceOptions = explode(',', $this->getRequest()->getParam('references'));
$handleOptionsUsed = explode(',', $this->getRequest()->getParam('handles_used'));
$handleOptionsHidden = $form->createElement('hidden', 'handles', array('decorators' => array('ViewHelper')));
$referenceOptionsHidden = $form->createElement('hidden', 'references', array('decorators' => array('ViewHelper')));
$handleOptionsUsedHidden = $form->createElement('hidden', 'handles_used', array('decorators' => array('ViewHelper')));
$handle = $form->createElement('radio', 'handle', array('label' => 'Handle', 'required' => true, 'multiOptions' => array_combine($handleOptions, $handleOptions), 'description' => 'NOTE: This are the handles that this block appears in: ' . $this->getRequest()->getParam('handles_used')));
$reference = $form->createElement('radio', 'reference', array('label' => 'Reference', 'required' => true, 'multiOptions' => array_combine($referenceOptions, $referenceOptions)));
$name = $form->createElement('text', 'name', array('label' => 'Name', 'required' => true));
$submit = $form->createElement('submit', 'submit', array('label' => 'Submit'));
$form->addElements(array($handleOptionsHidden, $referenceOptionsHidden, $handleOptionsUsedHidden, $handle, $reference, $name, $submit));
if ($form->isValid($this->getRequest()->getParams())) {
$localXmlWriter = Mage::getModel('devel/writer_localxml');
$localXmlWriter->addRemove($form->handle->getValue(), $form->reference->getValue(), $form->name->getValue());
$localXmlWriter->save();
die('DONE. You need to reload to see changes!');
} else {
$this->loadLayout();
$this->getLayout()->getUpdate()->load('devel_layout_wizard');
$this->getLayout()->generateXml();
$this->loadLayout();
$this->getLayout()->getBlock('devel_wizard_form')->setForm($form);
$this->renderLayout();
}
}
示例14: getForm
public function getForm()
{
$form = new Zend_Form();
$form->setMethod('post');
$form->setDecorators(array(array('ViewScript', array('viewScript' => 'reports/report4Form.phtml'))));
$items = $this->getPeriodItems('REQ_MOZ_CONTMOVEMENT_PLAN_YEAR');
$e = new Zend_Form_Element_Select('period', array('label' => 'Період', 'multiOptions' => $items, 'required' => true, 'style' => 'width: 80px'));
$form->addElement($e);
$items = $this->getGuideItems('T_EDUFORM', false);
$e = new Zend_Form_Element_Select('eduform', array('label' => 'Форма навчання', 'multiOptions' => $items, 'style' => 'width: 200px'));
$form->addElement($e);
$items = $this->getGuideItems('T_EDUBASIS', false);
$e = new Zend_Form_Element_Select('edubase', array('label' => 'Форма фінансування', 'multiOptions' => $items, 'style' => 'width: 200px'));
$form->addElement($e);
$items = $this->getGuideItems('T_COUNTRYTYPE', false);
$e = new Zend_Form_Element_Select('countrytype', array('label' => 'Тип громадянства', 'multiOptions' => $items, 'style' => 'width: 200px'));
$form->addElement($e);
$refreshAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'page', 'action' => 'show'));
$e = new Zend_Form_Element_Submit('refresh', array('label' => 'Обновити', 'onclick' => "document.forms[0].action='{$refreshAct}'"));
$form->addElement($e);
$excelAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'reports', 'action' => 'excel', 'report' => 4));
$e = new Zend_Form_Element_Submit('excel', array('label' => 'Excel', 'onclick' => "document.forms[0].action='{$excelAct}'"));
$form->addElement($e);
$form->setElementDecorators(array('ViewHelper', 'Errors'));
return $form;
}
示例15: getMailForm
public static function getMailForm($docid)
{
$form = new Zend_Form();
$form->setMethod('post')->setAttrib('onsubmit', 'return checkReply(this);')->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'zend_form')), 'Form'));
$form->addElements(array(array('select', 'to', array('label' => 'To', 'required' => true, 'multiOptions' => array_merge(array('' => ''), array_keys(self::getRecipients($docid))))), array('text', 'replyto', array('label' => 'Your e-mail address', 'validators' => array(array('EmailAddress')))), array('textarea', 'body', array('label' => 'Message body', 'required' => true, 'rows' => '7', 'cols' => '70', 'validators' => array(array('StringLength', true, array(0, 5000))), 'filters' => array('StringTrim')))));
$form->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$form->addElements(array(array('captcha', 'captcha', array('label' => 'Enter safety code', 'required' => true, 'ignore' => true, 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 5, 'timeout' => 600), 'decorators' => array('Captcha', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))))), array('submit', 'submit', array('label' => 'Send', 'decorators' => array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('Label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))))));
return $form;
}