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


PHP Submit::setAttribute方法代码示例

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


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

示例1: __construct

 public function __construct(AuthenticationService $authService)
 {
     parent::__construct('login');
     $this->filter = new InputFilter();
     $email = new Element\Email('email');
     $email->setAttribute('required', true);
     $email->setAttribute('placeholder', 'Email Address');
     $this->add($email);
     $emailFilter = new Input('email');
     $emailFilter->setRequired(true);
     $this->filter->add($emailFilter);
     $password = new Element\Password('password');
     $password->setAttribute('required', true);
     $password->setAttribute('placeholder', 'Password');
     $this->add($password);
     $passwordFilter = new Input('password');
     $passwordFilter->setRequired(true);
     $passwordFilter->getValidatorChain()->attach(new AuthValidator\Authentication(array('message' => 'Invalid email address or password', 'service' => $authService, 'adapter' => $authService->getAdapter(), 'identity' => 'email', 'credential' => 'password')));
     $this->filter->add($passwordFilter);
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-primary pull-right');
     $submit->setOption('glyphicon', 'log-in');
     $submit->setLabel('Log In');
     $buttons->add($submit);
     $forgot = new Element\Submit('forgot');
     $forgot->setAttribute('formnovalidate', true);
     $forgot->setAttribute('class', 'btn-warning pull-right');
     $forgot->setOption('glyphicon', 'question-sign');
     $forgot->setLabel('Forgot Password');
     $buttons->add($forgot);
     $this->add($buttons);
 }
开发者ID:PoetikDragon,项目名称:USCSS,代码行数:35,代码来源:Login.php

示例2: __construct

 public function __construct($name = null)
 {
     parent::__construct('book');
     $this->add(array('name' => 'id', 'type' => 'Hidden'));
     $this->add(array('name' => 'title', 'type' => 'text', 'options' => array('label' => 'Title')));
     /*
            $this->add(array(
                'name' => 'author',
                'type' => 'text',
                'options' => array(
                    'label' => 'author',
                ),
            ));
     */
     $authorTextInput = new Element\Text($name = 'author');
     $authorTextInput->setLabel('author');
     $this->add($authorTextInput);
     /*
             $this->add(array(
                 'name' => 'submit',
                 'type' => 'submit',
                 'attributes' => array(
                     'value' => 'Go',
                     'id' => 'submitbutton',
                 ),
             ));        
     */
     $submitButton = new Element\Submit($name = 'submit');
     $submitButton->setAttribute('value', 'Go');
     $submitButton->setAttribute('id', 'submitButton');
     $this->add($submitButton);
 }
开发者ID:billjordan,项目名称:zend-app,代码行数:32,代码来源:BookForm.php

示例3: addElements

 public function addElements()
 {
     $file = new Element\File('image-file');
     $file->setLabel('Edit Your Image')->setAttribute('id', 'image-file')->setAttribute('multiple', true);
     $this->add($file);
     $submit = new Element\Submit('submit');
     $submit->setValue('Validation');
     $submit->setAttribute('class', 'btn btn-primary');
     $submit->setAttribute('id', 'submit');
     $this->add($submit);
 }
开发者ID:antuan-sehikyan,项目名称:ImageManager,代码行数:11,代码来源:ImageForm.php

示例4: __construct

 public function __construct()
 {
     parent::__construct('category');
     $this->setHydrator(new ClassMethodsHydrator(false));
     $this->add(array('name' => 'id', 'type' => 'hidden'));
     $this->add(array('name' => 'title', 'type' => 'text', 'attributes' => array('class' => 'form-control', 'placeholder' => 'category')));
     $submitField = new Element\Submit('submit');
     $submitField->setValue('Validation');
     $submitField->setAttribute('class', 'btn btn-primary');
     $submitField->setAttribute('id', 'submitbutton');
     $this->add($submitField);
 }
开发者ID:antuan-sehikyan,项目名称:TinyBlog,代码行数:12,代码来源:CategoryForm.php

示例5: __construct

 public function __construct(ObjectManager $objectManager)
 {
     parent::__construct('post-form');
     $this->setHydrator(new DoctrineHydrator($objectManager, 'TinyBlog\\Entity\\Post', true));
     $this->setAttribute('class', 'form-horizontal');
     $postFieldset = new PostFieldset($objectManager);
     $postFieldset->setUseAsBaseFieldset(true);
     $this->add($postFieldset);
     $this->add(array('type' => 'Zend\\Form\\Element\\Csrf', 'name' => 'csrf'));
     $submitField = new Element\Submit('submit');
     $submitField->setValue('Validation');
     $submitField->setAttribute('class', 'btn btn-primary');
     $submitField->setAttribute('id', 'submitbutton');
     $this->add($submitField);
 }
开发者ID:antuan-sehikyan,项目名称:TinyBlog,代码行数:15,代码来源:PostForm.php

示例6: addElements

 public function addElements()
 {
     //-- Profile name --
     $login = new Element\Text('profile_name');
     $login->setAttribute('placeholder', 'profile_name');
     $login->setAttribute('required', 'true');
     $login->setAttribute('class', 'form-control');
     $login->setAttribute('id', 'profile-name');
     $login->setLabel('Profile name');
     $login->setLabelAttributes(array('class' => 'control-label', 'for' => 'profile-name'));
     //-- Password --
     $password = new Element\Password('password');
     $password->setAttribute('placeholder', '*****');
     $password->setAttribute('required', 'true');
     $password->setAttribute('class', 'form-control');
     $password->setAttribute('id', 'password');
     $password->setLabel('Password');
     $password->setLabelAttributes(array('class' => 'control-label', 'for' => 'password'));
     //-- Submit --
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn btn-success');
     $submit->setValue('Send');
     // Binding elements
     $this->add($login);
     $this->add($password);
     $this->add($submit);
 }
开发者ID:anton-phpcurs,项目名称:aperture,代码行数:27,代码来源:LoginForm.php

示例7: addElements

 public function addElements()
 {
     //-- E-mail current ------------------------------------
     $email_current = new Element\Email('email_current');
     $email_current->setAttribute('readonly', 'true');
     $email_current->setAttribute('class', 'form-control');
     $email_current->setAttribute('id', 'email-old');
     $email_current->setLabel('Current');
     $email_current->setLabelAttributes(array('class' => 'control-label', 'for' => 'email-current'));
     //-- E-mail new ---------------------------------------
     $email = new Element\Email('email');
     $email->setAttribute('placeholder', 'example@example.com');
     $email->setAttribute('required', 'true');
     $email->setAttribute('class', 'form-control');
     $email->setAttribute('id', 'email');
     $email->setLabel('New');
     $email->setLabelAttributes(array('class' => 'control-label', 'for' => 'email'));
     //-- Submit -------------------------------------
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn btn-success');
     $submit->setValue('Send');
     // Binding elements
     $this->add($email_current);
     $this->add($email);
     $this->add($submit);
 }
开发者ID:anton-phpcurs,项目名称:aperture,代码行数:26,代码来源:EmailForm.php

示例8: __construct

 /**
  * @param string $submitName
  * @param string $submitClass
  */
 public function __construct($submitName = 'Save', $submitClass = 'btn-primary')
 {
     parent::__construct('buttons');
     $this->setOption('twb-layout', 'inline');
     $this->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('value', $submitName);
     $submit->setAttribute('class', $submitClass . ' pull-right');
     $this->add($submit);
     $cancel = new Element\Submit('cancel');
     $cancel->setAttribute('value', 'Cancel');
     $cancel->setAttribute('formnovalidate', true);
     $cancel->setAttribute('data-dismiss', 'modal');
     $cancel->setAttribute('class', 'btn-warning pull-right');
     $this->add($cancel);
 }
开发者ID:PoetikDragon,项目名称:USCSS,代码行数:20,代码来源:Buttons.php

示例9: prepareElements

 public function prepareElements($topicList, $categoryList, $captchaOptions)
 {
     // repurpose $topicList and $categoryList
     $topics = array('---' => 'Choose');
     foreach ($topicList as $item) {
         $topics[$item->item] = $item->item;
     }
     $categories = array('---' => 'Choose');
     foreach ($categoryList as $item) {
         $categories[$item->item] = $item->item;
     }
     $author = new Element\Hidden('author');
     $category1 = new Element\Text('category');
     $category1->setLabel('Category')->setAttribute('title', 'Enter a category: i.e. zf2 or use the dropdown list below')->setAttribute('size', 16)->setAttribute('maxlength', 16);
     $category2 = new Element\Select('selectCategory');
     $category2->setValueOptions($categories);
     $topic1 = new Element\Text('topic');
     $topic1->setLabel('Topic')->setAttribute('title', 'Enter a topic code: i.e. zf2f-2013-02-25 or use the dropdown list below')->setAttribute('size', 60)->setAttribute('maxlength', 254);
     $topic2 = new Element\Select('selectTopic');
     $topic2->setValueOptions($topics);
     $title = new Element\Text('title');
     $title->setLabel('Title')->setAttribute('title', 'Enter a suitable title for this posting')->setAttribute('size', 60)->setAttribute('maxlength', 254);
     $body = new Element\Textarea('body');
     $body->setLabel('Body')->setAttribute('title', 'Enter the body for this posting')->setAttribute('rows', 4)->setAttribute('cols', 60);
     $captcha = new Element\Captcha('captcha');
     $captchaAdapter = new Captcha\Image();
     $captchaAdapter->setWordlen(4)->setOptions($captchaOptions);
     $captcha->setCaptcha($captchaAdapter)->setLabel('Help us to prevent SPAM!')->setAttribute('class', 'captchaStyle')->setAttribute('title', 'Help to prevent SPAM');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('value', 'Post')->setAttribute('title', 'Click here when done');
     $this->add($author)->add($topic1)->add($topic2)->add($category1)->add($category2)->add($title)->add($body)->add($captcha)->add($submit);
 }
开发者ID:jordiwes,项目名称:zf2.unlikelysource.org,代码行数:32,代码来源:ForumForm.php

示例10: __construct

 public function __construct($useOldPassword = true)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'panel-body');
     if ($useOldPassword) {
         $oldPassword = new Password('oldPassword');
         $oldPassword->setLabel('old.password');
         $oldPassword->setAttribute('class', 'form-control');
         $this->add($oldPassword);
     }
     $password = new Password('password');
     $password->setLabel('password');
     $password->setAttribute('class', 'form-control');
     $this->add($password);
     $password2 = new Password('password2');
     $password2->setLabel('repeat.password');
     $password2->setAttribute('class', 'form-control');
     $this->add($password2);
     $captcha = new Captcha('register_captcha');
     $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']);
     $imageAdapter->setHeight(100);
     $imageAdapter->setWidth(400);
     $imageAdapter->setFontSize(48);
     $imageAdapter->setDotNoiseLevel(400);
     $imageAdapter->setLineNoiseLevel(40);
     $captcha->setCaptcha($imageAdapter);
     $captcha->setLabel('enter.text.from.the.picture');
     $captcha->setAttribute('class', 'form-control');
     $this->add($captcha);
     $submit = new Submit('save');
     $submit->setValue('save');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
开发者ID:zend-bricks,项目名称:bricks-user,代码行数:35,代码来源:ChangePasswordForm.php

示例11: indexAction

 /**
  * The default action - show the home page
  */
 public function indexAction()
 {
     // init vars
     $data = NULL;
     $table = $this->getServiceLocator()->get('city-codes-table');
     $catList = $this->getServiceLocator()->get('form-demo-categories');
     $cityList = $table->getAllCityCodesForForm();
     $countryList = $table->getAllCountryCodesForForm();
     // submit button
     $submit = new Submit('submit');
     $submit->setAttribute('value', 'Submit');
     // build form
     $builder = new AnnotationBuilder();
     $entity = $this->getServiceLocator()->get('form-demo-listings-entity');
     $form = $builder->createForm($entity);
     $form->get('category')->setValueOptions(array_combine($catList, $catList));
     $form->getInputFilter()->get('category')->getValidatorChain()->attachByName('InArray', array('haystack' => $catList));
     $form->get('country')->setValueOptions($countryList);
     $form->getInputFilter()->get('country')->getValidatorChain()->attachByName('InArray', array('haystack' => $countryList));
     $form->add($submit);
     $form->bind($entity);
     if ($this->getRequest()->isPost()) {
         $form->setData($this->params()->fromPost());
         if ($form->isValid()) {
             $data = $form->getData();
         }
     }
     return new ViewModel(array('form' => $form, 'data' => $data, 'cityList' => $cityList));
 }
开发者ID:jordiwes,项目名称:zf2.unlikelysource.org,代码行数:32,代码来源:AnnotationController.php

示例12: __construct

 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'panel-body');
     $mail = new Email('email');
     $mail->setLabel('email');
     $mail->setAttribute('class', 'form-control');
     $this->add($mail);
     $captcha = new Captcha('register_captcha');
     $imageAdapter = new Image(['font' => __DIR__ . '/../../fonts/arial.ttf']);
     $imageAdapter->setHeight(100);
     $imageAdapter->setWidth(400);
     $imageAdapter->setFontSize(48);
     $imageAdapter->setDotNoiseLevel(400);
     $imageAdapter->setLineNoiseLevel(40);
     $captcha->setCaptcha($imageAdapter);
     $captcha->setLabel('enter.text.from.the.picture');
     $captcha->setAttribute('class', 'form-control');
     $this->add($captcha);
     $submit = new Submit('send');
     $submit->setValue('send');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
开发者ID:zend-bricks,项目名称:bricks-user,代码行数:25,代码来源:SpecifyMailForm.php

示例13: addSubmitElement

 /**
  * Add submit element
  */
 public function addSubmitElement($name = 'save', $label = 'Speichern')
 {
     $element = new Submit($name);
     $element->setValue($label);
     $element->setAttribute('class', 'btn');
     $this->add($element);
 }
开发者ID:andreaszobl,项目名称:software,代码行数:10,代码来源:BlogForm.php

示例14: buildForm

 public function buildForm()
 {
     $this->setAttribute('method', 'POST');
     $category = new Select('category');
     $category->setLabel('Category')->setValueOptions(array_combine($this->getCategories(), $this->getCategories()));
     $title = new Text('title');
     $title->setLabel('Title')->setAttributes(array('size' => 50, 'maxLength' => 128, 'required' => 'required', 'placeholder' => 'Title', 'title' => 'Title'));
     $photo = new Text('photo_filename');
     $photo->setLabel('Photo')->setAttribute('maxlength', 1024)->setAttribute('placeholder', 'Enter a valid image file URL');
     $name = new Text('contact_name');
     $name->setLabel('Contact Name')->setAttribute('title', 'Contact Name')->setAttribute('size', 50)->setAttribute('maxlength', 255);
     $email = new Email('contact_email');
     $email->setLabel('Contact Email')->setAttribute('title', 'Contact Email')->setAttribute('size', 50)->setAttribute('maxlength', 255);
     $phone = new Text('contact_phone');
     $phone->setLabel('Contact Phone Number')->setAttribute('title', 'Contact Phone Number')->setAttribute('size', 20)->setAttribute('maxlength', 32);
     $city = new Select('cityCode');
     $city->setLabel('Nearest City')->setValueOptions(array_combine(self::$cityCodes, self::$cityCodes))->setAttribute('id', 'cityCode');
     $price = new Text('price');
     $price->setLabel('Price')->setAttribute('title', 'Price as nnn.nn')->setAttribute('size', 16)->setAttribute('maxlength', 16);
     $expires = new Radio('expires');
     $expires->setLabel('Expires')->setAttribute('title', 'The expiration date from today')->setAttribute('class', 'expiresButton')->setValueOptions($this->getExpireDays());
     $deleteCode = new Text('delete_code');
     $deleteCode->setLabel('Delete Code')->setAttribute('title', 'Delete code for this item')->setAttribute('size', 16)->setAttribute('maxlength', 16);
     $description = new Textarea('description');
     $description->setLabel('Description')->setAttribute('title', 'Description')->setAttribute('rows', 5)->setAttribute('cols', 80);
     $captchaAdapter = new ImageCaptcha();
     $captchaAdapter->setWordlen(4)->setOptions($this->captchaOptions);
     $captcha = new Captcha('captcha');
     $captcha->setCaptcha($captchaAdapter)->setLabel('Help us to prevent SPAM!')->setAttribute('class', 'captchaStyle')->setAttribute('title', 'Help us to prevent SPAM');
     $submit = new Submit('submit');
     $submit->setAttribute('value', 'Post');
     $this->add($category)->add($title)->add($photo)->add($name)->add($email)->add($phone)->add($city)->add($price)->add($expires)->add($deleteCode)->add($description)->add($captcha)->add($submit);
 }
开发者ID:saulotoledo,项目名称:ZF2Course,代码行数:33,代码来源:PostForm.php

示例15: __construct

 public function __construct()
 {
     parent::__construct('add');
     $hydrator = new AggregateHydrator();
     $hydrator->add(new PostHydrator());
     $hydrator->add(new CategoryHydrator());
     $this->setHydrator($hydrator);
     $title = new Element\Text('title');
     $title->setLabel('Title');
     $title->setAttribute('class', 'form-control');
     $slug = new Element\Text('slug');
     $slug->setLabel('Slug');
     $slug->setAttribute('class', 'form-control');
     $content = new Element\Textarea('content');
     $content->setLabel('Content');
     $content->setAttribute('class', 'form-control');
     $category = new Element\Select('category_id');
     $category->setLabel('Category');
     $category->setAttribute('class', 'form-control');
     $category->setValueOptions(array(1 => 'WIN', 2 => 'BUILD', 3 => 'SEND', 4 => 'GENERAL'));
     $submit = new Element\Submit('submit');
     $submit->setValue('Add News');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($title);
     $this->add($slug);
     $this->add($content);
     $this->add($category);
     $this->add($submit);
 }
开发者ID:samija,项目名称:Deeplifec4tk,代码行数:29,代码来源:Add.php


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