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


PHP Html::beginForm方法代码示例

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


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

示例1: launch

 protected function launch()
 {
     echo Html::beginForm($this->url, 'get');
     echo Html::input('text', $this->queryParam, $this->query);
     echo Html::submitButton(\Yii::t('gromver.platform', 'Find'));
     echo Html::endForm();
 }
开发者ID:gromver,项目名称:yii2-platform,代码行数:7,代码来源:SearchForm.php

示例2: run

 public function run()
 {
     SelectAsset::register($this->view);
     FilterAsset::register($this->view);
     $values = [];
     foreach ($this->data as $value) {
         $value = strval($value);
         $values[$value] = $value;
     }
     if (!$this->default) {
         $this->default = $this->multiple ? array_keys($values) : key($values);
     }
     $selected = $this->selected($this->default);
     // Setup options
     $options = ['id' => $this->name, 'name' => $this->name . '[]', 'style' => 'width: 300px;', 'class' => 'selectpicker'];
     $extra = ['title' => 'Not selected'];
     if ($this->multiple) {
         $extra['multiple'] = 'multiple';
     }
     if ($this->placeholder) {
         $extra['title'] = strval($this->placeholder);
     }
     $options = array_merge($options, $extra);
     if (!$this->method) {
         $this->method = 'get';
     }
     // Render
     echo Html::beginForm(Url::canonical(), $this->method, ['data-pjax' => '1', 'id' => $this->name]);
     echo Html::beginTag('select', $options, ['data-pjax' => '1']);
     echo Html::renderSelectOptions($selected, $values);
     echo Html::endTag("select");
     echo Html::endForm();
     parent::run();
 }
开发者ID:Polymedia,项目名称:BI-Platform-v3,代码行数:34,代码来源:Filter.php

示例3: actionForm

 public function actionForm()
 {
     echo Html::beginForm();
     echo Html::checkboxList('test', ['value 1' => 'item 1', 'value 2' => 'item 2', 'value 3' => 'item 3'], isset($_POST['test']) ? $_POST['test'] : null, function ($index, $label, $name, $value, $checked) {
         return Html::label($label . ' ' . Html::checkbox($name, $value, $checked), null, ['class' => 'inline checkbox']);
     });
     echo Html::submitButton();
     echo Html::endForm();
     print_r($_POST);
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:10,代码来源:SiteController.php

示例4: run

 public function run()
 {
     $id = $this->getId();
     echo Html::beginForm(Url::canonical(), 'get', ['data-pjax' => '1', 'id' => $this->name]);
     echo Html::beginTag('div');
     echo Html::beginTag("select", ['id' => $id, 'multiple' => 'multiple', 'class' => 'invisible', 'style' => 'width: ' . $this->width . 'px;', 'name' => $this->name . '[]']);
     echo Html::renderSelectOptions($this->selectedValues, $this->_allValues);
     echo Html::endTag("select");
     echo Html::submitButton('OK', ['style' => 'margin: 0 5px;']);
     echo Html::endTag('div');
     echo Html::endForm();
     echo "<script type='text/javascript'>";
     echo "\$('#{$id}').removeClass('invisible');";
     echo "\$('#{$id}').multipleSelect()";
     echo "</script>";
 }
开发者ID:Polymedia,项目名称:BI-Platform-v3,代码行数:16,代码来源:MultipleSelect.php

示例5: init

 public function init()
 {
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     switch ($this->type) {
         case self::TYPE_HORIZONTAL:
             if ($this->stripped) {
                 Html::addCssClass($this->options, 'form-row-stripped');
             }
             if ($this->separated) {
                 Html::addCssClass($this->options, 'form-row-seperated');
             }
             if ($this->bordered) {
                 Html::addCssClass($this->options, 'form-bordered');
             }
             if ($this->bordered) {
                 Html::addCssClass($this->options, 'form-label-stripped');
             }
             Html::addCssClass($this->options, 'form-horizontal');
             $this->fieldConfig = ArrayHelper::merge(['labelOptions' => ['class' => 'col-md-3 control-label'], 'template' => "{label}\n" . Html::tag('div', "{input}\n{error}\n{hint}", $this->tagOptions)], $this->fieldConfig);
             break;
         case self::TYPE_INLINE:
             Html::addCssClass($this->options, 'form-inline');
             break;
     }
     if (!isset($this->fieldConfig['class'])) {
         $this->fieldConfig['class'] = ActiveField::className();
     }
     echo Html::beginForm($this->action, $this->method, $this->options);
     echo $this->renderActions(self::BUTTONS_POSITION_TOP);
     Html::addCssClass($this->bodyOptions, 'form-inline');
     echo Html::beginTag('div', $this->bodyOptions);
 }
开发者ID:wfcreations,项目名称:yii2-metronic,代码行数:34,代码来源:ActiveForm.php

示例6: testBeginForm

 public function testBeginForm()
 {
     $this->assertEquals('<form action="/test" method="post">', Html::beginForm());
     $this->assertEquals('<form action="/example" method="get">', Html::beginForm('/example', 'get'));
     $hiddens = ['<input type="hidden" name="id" value="1">', '<input type="hidden" name="title" value="&lt;">'];
     $this->assertEquals('<form action="/example" method="get">' . "\n" . implode("\n", $hiddens), Html::beginForm('/example?id=1&title=%3C', 'get'));
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:7,代码来源:HtmlTest.php

示例7: begin

    public static function begin($config = [])
    {
        $defaults = ArrayHelper::remove($config, 'defaults', []);
        $w = parent::begin($config);
        $w->defaults = ArrayHelper::merge($w->defaults, $defaults);
        $view = $w->getView();
        echo Html::beginForm($w->action, $w->method, ArrayHelper::merge(ArrayHelper::getValue($config, 'options', []), ['id' => $w->id, 'method' => 'POST', 'enctype' => 'multipart/form-data']));
        KnockoutAsset::register($view);
        // client side validate on submit
        if ($w->validateOnSubmit) {
            $view->registerJs(sprintf(<<<EOD
\$('#%1\$s').submit(function(e) {
    var vm = ko.dataFor(e.target);
    if (vm && vm.validate) {
        vm.validate();
    }

    if (vm && vm.isValid && vm.isValid()) {
        return true;
    } else {
        e.preventDefault();
        return false;
    }
})
EOD
, $w->id, Json::encode($w->defaults)), View::POS_END);
        }
        //         $view->registerJs(sprintf(<<<EOD
        // var %1\$s = $.extend({}, x1.config, %2\$s);
        // EOD
        // , lcfirst(\yii\helpers\Inflector::camelize($w->id)), Json::encode($w->defaults)));
        return $w;
    }
开发者ID:e-frank,项目名称:yii2-knockout,代码行数:33,代码来源:ActiveForm.php

示例8: init

 /**
  * Initializes the widget.
  * This renders the form open tag.
  */
 public function init()
 {
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if ($this->init) {
         echo Html::beginForm($this->action, $this->method, $this->options);
     }
 }
开发者ID:bariew,项目名称:yii2-tools,代码行数:13,代码来源:ActiveForm.php

示例9: renderNavItem

 /**
  * @return string
  */
 public function renderNavItem()
 {
     $output = '<li>' . Html::beginForm($this->action, $this->method, $this->formOptions) . '<div class="input-group">';
     $output .= Html::input('text', $this->name, $this->value, $this->inputOptions);
     $output .= '<div class="input-group-btn">';
     $output .= Html::button('<i class="glyphicon glyphicon-search"></i>', $this->buttonOptions);
     $output .= '</div></div>' . Html::endForm() . '</li>';
     return $output;
 }
开发者ID:hauntd,项目名称:help-center,代码行数:12,代码来源:NavSearchItem.php

示例10: run

 public function run()
 {
     echo Html::beginForm(Url::to([$this->actionUrl]), 'post', []);
     if (!empty($this->returnUrl)) {
         echo Html::hiddenInput('returnUrl', $this->returnUrl);
     }
     echo Html::dropDownList('language', Yii::$app->language, Yii::$app->czaHelper->getEnabledLangs(), ['id' => $this->htmlId(), 'onchange' => 'this.form.submit()']);
     echo Html::endForm();
 }
开发者ID:bennybi,项目名称:yii2-cza-base,代码行数:9,代码来源:LanguageSelectBox.php

示例11: _getList

 private function _getList()
 {
     $menuItems = [];
     if (\Yii::$app->user->isGuest) {
         //          $menuItems[] = ['label' => 'Signup', 'visible' => \humanized\user\Module::getInstance()->params['enableSignUp'], 'url' => ['/user/account/signup']];
         $menuItems[] = ['label' => 'Login', 'url' => ['/user/account/login']];
     } else {
         $menuItems[] = '<li>' . Html::beginForm(['/user/account/logout'], 'post') . Html::submitButton('Logout (' . \Yii::$app->user->identity->email . ')', ['class' => 'btn btn-link']) . Html::endForm() . '</li>';
     }
     return $urls;
 }
开发者ID:Humanized,项目名称:yii2-user,代码行数:11,代码来源:Authentication.php

示例12: renderSortLinks

 /**
  * Renders the sort links.
  * @return string the rendering result
  */
 protected function renderSortLinks()
 {
     $attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
     $links = [];
     foreach ($attributes as $key => $name) {
         $links[$name] = $name;
     }
     echo Html::beginForm(null, 'get', []);
     echo Html::dropDownList('sort', null, $links, ['prompt' => 'Sortiraj po']);
     echo Html::submitButton('<i class="fa fa-sort"></i>', ['class' => 'btn btn-default margin-left-5']);
     echo Html::endForm();
 }
开发者ID:bokko79,项目名称:servicemapp,代码行数:16,代码来源:IndexSorter.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->name;
     }
     if (!isset($this->options['ng-submit'])) {
         $this->options['ng-submit'] = 'submit($event)';
     }
     $this->options['name'] = $this->name;
     $this->options['novalidate'] = true;
     echo Html::beginForm($this->action, $this->method, $this->options);
 }
开发者ID:rmrevin,项目名称:yii2-application,代码行数:15,代码来源:ActiveForm.php

示例14: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $popover = '';
     $popover .= Html::beginForm($this->action);
     if ($this->content) {
         $popover .= $this->content;
     }
     $popover .= Html::submitButton($this->btnText, ['class' => 'btn btn-success']);
     $popover .= Html::hiddenInput('id', $this->model['id']);
     $popover .= Html::endForm();
     $this->content = $popover;
     return parent::run();
 }
开发者ID:bigbrush,项目名称:yii2-cmf,代码行数:16,代码来源:DeleteButton.php

示例15: renderForm

 public function renderForm()
 {
     $action = ArrayHelper::remove($this->formOptions, 'action', '');
     $method = ArrayHelper::remove($this->formOptions, 'method', 'post');
     if (!isset($this->formOptions['id'])) {
         $this->formOptions['id'] = 'msg-form';
     }
     $content = Html::beginForm($action, $method, $this->formOptions);
     if (is_string($this->formView)) {
         $content .= $this->getView()->render($this->formView, array_merge(['widget' => $this], $this->formParams));
     } else {
         $content .= call_user_func($this->formView, $this);
     }
     $content .= Html::endForm();
     return $content;
 }
开发者ID:marciocamello,项目名称:yii2-simplechat,代码行数:16,代码来源:MessageWidget.php


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