当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_SubForm::setName方法代码示例

本文整理汇总了PHP中Zend_Form_SubForm::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_SubForm::setName方法的具体用法?PHP Zend_Form_SubForm::setName怎么用?PHP Zend_Form_SubForm::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_SubForm的用法示例。


在下文中一共展示了Zend_Form_SubForm::setName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $this->setName('addApplicant');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $product = new Zend_Form_Element_Text('product');
     $product->setLabel('* product:')->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $category = new Zend_Form_Element_Text('category');
     $category->setLabel("* category:")->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $group = new Zend_Form_Element_Text('group');
     $group->setLabel("* group:")->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $this->addElements(array($id, $product, $category, $group));
     //-------------------- add attr
     $institutions = new Zend_Form_SubForm();
     $institutions->setName('attr');
     $session = new Zend_Session_Namespace('form');
     foreach ($session->attr as $inst) {
         $rowForm = new Zend_Form_SubForm();
         $rowForm->setName($inst);
         if ($inst === '__template1__') {
             $rowForm->setAttrib('style', 'display: none;');
         }
         $instName = new Zend_Form_Element_Text('instName');
         $instName->setLabel('attribute')->addFilter('StripTags')->addFilter('stringTrim')->setAttrib('class', 'institution')->setAttrib('onfocus', 'institutionAutocomplete(this)');
         if ($inst !== '__template1__') {
             $instName->setRequired(true);
         }
         $inst_remove = new Zend_Form_Element_Button('remove');
         $inst_remove->setLabel('remove')->setAttrib('class', 'remove')->setAttrib('onclick', 'removeInst(this)');
         $elements = array($instName, $inst_remove);
         foreach ($elements as $element) {
             if ($inst !== '__template1__' && $element->getName() !== 'remove') {
                 $element->setRequired(true);
             }
         }
         $rowForm->addElements($elements);
         $rowForm->setElementDecorators($this->getElementDecorators());
         $rowForm->getElement('remove')->removeDecorator('Label');
         $rowForm->setDecorators($this->getSubFormDecorators());
         $institutions->addSubForm($rowForm, $inst);
     }
     $institutions->setDecorators($this->getSubFormDecorators());
     $inst_add = new Zend_Form_Element_Button('addInst');
     $inst_add->setLabel('add attribute')->setAttrib('class', 'addInst');
     $institutions->addElement($inst_add);
     $institutions->setElementDecorators($this->getElementDecorators());
     $institutions->getElement('addInst')->removeDecorator('Label');
     $this->addSubForm($institutions, 'institutions');
     $this->postSetup();
 }
开发者ID:varrbor,项目名称:hanuka.lviv.ua,代码行数:50,代码来源:SubForm.php

示例2: testAddingSubFormResetsBelongsToWithDifferentSubFormName

 public function testAddingSubFormResetsBelongsToWithDifferentSubFormName()
 {
     $subForm = new Zend_Form_SubForm();
     $subForm->setName('quo')->addElement('text', 'foo');
     $this->form->addSubForm($subForm, 'bar');
     $this->assertEquals('bar', $subForm->foo->getBelongsTo());
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:7,代码来源:FormTest.php

示例3: testCustomIdSupersedesElementId

 /**
  * @see ZF-7054
  */
 public function testCustomIdSupersedesElementId()
 {
     $form = new Zend_Form_SubForm();
     $form->setName('bar')->setView($this->getView());
     $html = $this->decorator->setElement($form)->setOption('id', 'foo-id')->render('content');
     $this->assertContains('foo-id', $html);
 }
开发者ID:travisj,项目名称:zf,代码行数:10,代码来源:FieldsetTest.php

示例4: __construct

 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     parent::__construct($options);
     $this->setAttrib('id', 'accountManagement');
     $this->setAttrib('class', 'step2');
     $baseDir = $this->getView()->baseUrl();
     //Hidden fields for the state and cities id
     $selectedState = new Zend_Form_Element_Hidden('selectedState');
     $selectedState->removeDecorator('label');
     $selectedCity = new Zend_Form_Element_Hidden('selectedCity');
     $selectedCity->removeDecorator('label');
     $this->addElement($selectedState);
     $this->addElement($selectedCity);
     /* billing address */
     // Billing address
     $addressFacturationSub = new Zend_Form_SubForm();
     $addressFacturationSub->setName('addressFact')->removeDecorator('DtDdWrapper');
     $addressFacturationSub->setLegend($this->getView()->getCibleText('form_account_subform_addBilling_legend'));
     $addressFacturationSub->setAttrib('class', 'addresseBillingClass subFormOrder');
     $billingAddr = new Cible_View_Helper_FormAddress($addressFacturationSub);
     $billingAddr->setProperty('addScriptState', false);
     $billingAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'cityTxt', 'zipCode', 'country', 'firstTel', 'secondTel'));
     $billingAddr->formAddress();
     $addrBill = new Zend_Form_Element_Hidden('addrBill');
     $addrBill->removeDecorator('label');
     $addressFacturationSub->addElement($addrBill);
     $this->addSubForm($addressFacturationSub, 'addressFact');
     /* delivery address */
     $addrShip = new Zend_Form_Element_Hidden('addrShip');
     $addrShip->removeDecorator('label');
     $addressShippingSub = new Zend_Form_SubForm();
     $addressShippingSub->setName('addressShipping')->removeDecorator('DtDdWrapper');
     $addressShippingSub->setLegend($this->getView()->getCibleText('form_account_subform_addShipping_legend'));
     $addressShippingSub->setAttrib('class', 'addresseShippingClass subFormOrder');
     $shipAddr = new Cible_View_Helper_FormAddress($addressShippingSub);
     $shipAddr->duplicateAddress($addressShippingSub);
     $shipAddr->setProperty('addScriptState', false);
     $shipAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'city', 'zipCode', 'country', 'firstTel', 'secondTel'));
     $shipAddr->formAddress();
     $addressShippingSub->addElement($addrShip);
     $this->addSubForm($addressShippingSub, 'addressShipping');
     //            $termsAgreement = new Zend_Form_Element_Checkbox('termsAgreement');
     //            $termsAgreement->setLabel(str_replace('%URL_TERMS_CONDITIONS%', Cible_FunctionsPages::getPageLinkByID($this->_config->termsAndConditions->pageId), $this->getView()->getClientText('form_label_terms_agreement')))
     //                           ->setDecorators(array(
     //                               'ViewHelper',
     //                                array('label', array('placement' => 'append')),
     //                                array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')),
     //                            ));
     //
     //            $this->addElement($termsAgreement);
     //Means of payment
     $paymentMeans = new Zend_Form_Element_Select('paymentMeans');
     $paymentMeans->setLabel($this->getView()->getCibleText('form_label_payment_means'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'selectPayment'))));
     $paymentMeans->addMultiOption('', $this->getView()->getClientText('cart_details_select_choose_label'));
     $paymentMeans->addMultiOption('visa', $this->getView()->getCibleText('form_label_payement_visa'));
     $paymentMeans->addMultiOption('mastercard', $this->getView()->getCibleText('form_label_payement_mastercard'));
     $paymentMeans->addMultiOption('compte', $this->getView()->getCibleText('form_label_payement_account'));
     $paymentMeans->addMultiOption('cod', $this->getView()->getCibleText('form_label_payement_cod'));
     $this->addElement($paymentMeans);
     // Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($this->getView()->getCibleText('form_label_next_step_btn'))->setAttrib('class', 'nextStepButton')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'stepBottomNext'))));
     $this->addElement($submit);
 }
开发者ID:anunay,项目名称:stentors,代码行数:65,代码来源:FormOrderAddr.php

示例5: __construct


//.........这里部分代码省略.........
         $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
         $termsAgreement->setRequired(true);
         $termsAgreement->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'You must agree to the terms')));
     } else {
         $termsAgreement = new Zend_Form_Element_Hidden('termsAgreement', array('value' => 1));
     }
     // Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($this->getView()->getCibleText('form_label_next_step_btn'))->setAttrib('class', 'nextStepButton');
     // Reference number for the job
     $txtConnaissance = new Cible_Form_Element_Html('knowYou', array('value' => $this->getView()->getCibleText('form_account_mieux_vous_connaitre_legend')));
     $txtConnaissance->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'description left'))));
     $refJobId = new Zend_Form_Element_Text('refJobId');
     $refJobId->setLabel('refJobId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     // Reference number for the role
     $refRoleId = new Zend_Form_Element_Text('refRoleId');
     $refRoleId->setLabel('refRoleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     // Reference number for the job title
     $refJobTitleId = new Zend_Form_Element_Text('refJobTitleId');
     $refJobTitleId->setLabel('refJobTitleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     $refJobTitleId = new Zend_Form_Element_Text('refJobTitleId');
     $refJobTitleId->setLabel('refJobTitleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput'));
     // Provincial tax exemption
     $noProvTax = new Zend_Form_Element_Checkbox('noProvTax');
     $noProvTax->setLabel($this->getView()->getCibleText('form_label_account_provincial_tax'));
     $noProvTax->setAttrib('class', 'long-text')->setOrder(13);
     $noProvTax->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     // Provincial tax exemption
     $noFedTax = new Zend_Form_Element_Checkbox('noFedTax');
     $noFedTax->setLabel($this->getView()->getCibleText('form_label_account_federal_tax'));
     $noFedTax->setAttrib('class', 'long-text')->setOrder(14);
     $noFedTax->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     /*  Identification sub form */
     $identificationSub = new Zend_Form_SubForm();
     $identificationSub->setName('identification')->removeDecorator('DtDdWrapper');
     $identificationSub->setLegend($this->getView()->getCibleText('form_account_subform_identification_legend'));
     $identificationSub->setAttrib('class', 'identificationClass subFormClass');
     $identificationSub->addElement($language);
     $identificationSub->addElement($salutation);
     $identificationSub->addElement($lastname);
     $identificationSub->addElement($firstname);
     $identificationSub->addElement($email);
     $identificationSub->addElement($password);
     $identificationSub->addElement($passwordConfirmation);
     $identificationSub->addElement($company);
     $this->addSubForm($identificationSub, 'identification');
     //            $identificationSub->addElement($functionCompany);
     $addrContactMedia = new Cible_View_Helper_FormAddress($identificationSub);
     if ($options['resume']) {
         $addrContactMedia->setProperty('addScript', false);
     }
     $addrContactMedia->enableFields(array('firstTel', 'secondTel', 'fax', 'webSite'));
     $addrContactMedia->formAddress();
     $identificationSub->addElement($noProvTax);
     $identificationSub->addElement($noFedTax);
     /*  Identification sub form */
     /* billing address */
     // Billing address
     $addressFacturationSub = new Zend_Form_SubForm();
     $addressFacturationSub->setName('addressFact')->removeDecorator('DtDdWrapper');
     $addressFacturationSub->setLegend($this->getView()->getCibleText('form_account_subform_addBilling_legend'));
     $addressFacturationSub->setAttrib('class', 'addresseBillingClass subFormClass');
     $billingAddr = new Cible_View_Helper_FormAddress($addressFacturationSub);
     $billingAddr->setProperty('addScriptState', false);
     if ($options['resume']) {
         $billingAddr->setProperty('addScript', false);
     }
     $billingAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'cityTxt', 'zipCode', 'country', 'firstTel', 'secondTel'));
     $billingAddr->formAddress();
     $addrBill = new Zend_Form_Element_Hidden('addrBill');
     $addrBill->removeDecorator('label');
     $addressFacturationSub->addElement($addrBill);
     $addressFacturationSub->getElement('AI_SecondAddress')->removeDecorator('label');
     $this->addSubForm($addressFacturationSub, 'addressFact');
     /* delivery address */
     $addrShip = new Zend_Form_Element_Hidden('addrShip');
     $addrShip->removeDecorator('label');
     $addressShippingSub = new Zend_Form_SubForm();
     $addressShippingSub->setName('addressShipping')->removeDecorator('DtDdWrapper');
     $addressShippingSub->setLegend($this->getView()->getCibleText('form_account_subform_addShipping_legend'));
     $addressShippingSub->setAttrib('class', 'addresseShippingClass subFormClass');
     $shipAddr = new Cible_View_Helper_FormAddress($addressShippingSub);
     if ($options['resume']) {
         $shipAddr->setProperty('addScript', false);
     }
     $shipAddr->duplicateAddress($addressShippingSub);
     $shipAddr->setProperty('addScriptState', false);
     $shipAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'cityTxt', 'zipCode', 'country', 'firstTel', 'secondTel'));
     $shipAddr->formAddress();
     $addressShippingSub->addElement($addrShip);
     $this->addSubForm($addressShippingSub, 'addressShipping');
     if ($this->_mode == 'edit') {
         $this->addElement($termsAgreement);
     }
     $this->addElement($submit);
     $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'stepBottomNext'))));
     if ($this->_mode == 'add') {
         $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox', 'id' => 'dd-terms-agreement'))));
     }
 }
开发者ID:anunay,项目名称:stentors,代码行数:101,代码来源:FormOrder.php


注:本文中的Zend_Form_SubForm::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。