本文整理汇总了PHP中kartik\form\ActiveForm::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm::begin方法的具体用法?PHP ActiveForm::begin怎么用?PHP ActiveForm::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\form\ActiveForm
的用法示例。
在下文中一共展示了ActiveForm::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
//index view
$viewId = Yii::$app->request->get('view_id');
if (!isset($viewId)) {
?>
<button type="button" class="btn btn-primary btn-lg" onclick="javascript: $('#address').toggle()">新建收货地址</button>
<?php
}
?>
<div id="address" style="display: <?php
echo isset($viewId) ? 'block' : 'none';
?>
">
<?php
$form = \kartik\form\ActiveForm::begin();
/* @var \yincart\customer\models\CustomerAddress $model */
echo $form->field($model, 'province')->dropDownList($catList, ['id' => 'cat-id']);
// Child # 1
echo $form->field($model, 'city')->widget(DepDrop::classname(), ['data' => [$model->city => isset($model->cityArea) ? $model->cityArea->name : ''], 'options' => ['id' => 'subcat-id'], 'pluginOptions' => ['depends' => ['cat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/customer/get-cities'])]]);
// Child # 2
echo $form->field($model, 'district')->widget(DepDrop::classname(), ['data' => [$model->district => isset($model->districtArea) ? $model->districtArea->name : ''], 'pluginOptions' => ['depends' => ['cat-id', 'subcat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/customer/get-district'])]]);
?>
<?php
echo $form->field($model, 'address')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'zip_code')->textInput(['maxlength' => 255]);
?>
示例2:
<?php
use yii\helpers\Html;
use kartik\form\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\modules\admin\models\UserSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-search">
<?php
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>
<?php
echo $form->field($model, 'id');
?>
<?php
echo $form->field($model, 'created_at');
?>
<?php
echo $form->field($model, 'updated_at');
?>
<?php
echo $form->field($model, 'username');
?>
示例3:
<?php
}
?>
<?php
echo $this->title;
?>
<small>последнее обновление <?php
echo Yii::$app->formatter->asDate($user->updatedAt->sec);
?>
</small>
</h3>
</div>
<?php
$form = ActiveForm::begin(['enableClientValidation' => false]);
?>
<div class="row">
<div class="col-lg-7">
<?php
echo $form->field($model, 'email')->widget(MaskedInput::className(), ['clientOptions' => ['alias' => 'email']]);
?>
<?php
echo $form->field($model, 'lastName');
?>
<?php
示例4:
<?php
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use kartik\form\ActiveForm;
use kartik\widgets\SwitchInput;
use lukisongroup\hrd\models\Corp;
$userCorp = ArrayHelper::map(Corp::find()->all(), 'CORP_ID', 'CORP_NM');
$aryParent = [['PARENT' => 0, 'PAREN_NM' => 'UMUM'], ['PARENT' => 1, 'PAREN_NM' => 'PRODAK']];
$valParent = ArrayHelper::map($aryParent, 'PARENT', 'PAREN_NM');
?>
<div class="tipebarang-form">
<?php
$form = ActiveForm::begin(['id' => 'createtipe', 'enableClientValidation' => true, 'type' => ActiveForm::TYPE_HORIZONTAL, 'method' => 'post', 'action' => ['tipebarang/simpan']]);
?>
<?php
echo $form->field($model, 'CORP_ID')->dropDownList($userCorp, ['id' => 'rodetail-kd_type'])->label('Perusahaan');
?>
<?php
echo $form->field($model, 'PARENT')->dropDownList($valParent);
?>
<?php
echo $form->field($model, 'NM_TYPE')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'NOTE')->textarea(['rows' => 6]);
?>
示例5:
use kartik\form\ActiveForm;
use kartik\daterange\DateRangePicker;
use kartik\widgets\Select2;
/* @var $this yii\web\View */
/* @var $model humanized\scoopit\models\ScoopSearch */
/* @var $form yii\widgets\ActiveForm */
/*
*
*
*/
?>
<div class="scoop-search">
<?php
$form = ActiveForm::begin(['method' => 'get']);
?>
<?php
echo $form->field($model, 'title')->label(false)->textInput(['placeholder' => 'freetext search']);
?>
<?php
if (isset($afterSearchTextCallback)) {
call_user_func($afterSearchTextCallback, $this, $form, $model);
}
echo $form->field($model, 'date_published', ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-calendar"></i>']], 'options' => ['class' => 'drp-container form-group']])->widget(DateRangePicker::classname(), ['useWithAddon' => true, 'convertFormat' => true, 'presetDropdown' => true, 'pluginOptions' => ['locale' => ['format' => 'd M Y', 'separator' => ' to '], 'opens' => 'left']]);
if (isset($afterSearchCalendarCallback)) {
call_user_func($afterSearchCalendarCallback, $this, $form, $model);
}
// Normal select with ActiveForm & model
示例6:
<?php
use kartik\form\ActiveForm;
use kartik\icons\Icon;
use kartik\widgets\Select2;
use yii\helpers\Html;
?>
<div class="well">
<?php
echo $this->render('alert');
?>
<?php
$form = ActiveForm::begin(['id' => 'Administrator', 'action' => \yii\helpers\Url::to(['']), 'type' => ActiveForm::TYPE_HORIZONTAL, 'enableClientScript' => false, 'enableClientValidation' => true, 'encodeErrorSummary' => false, 'formConfig' => ['labelSpan' => 3], 'options' => ['onkeypress' => "return event.keyCode != 13;"]]);
echo $form->errorSummary($admin, ['class' => 'alert alert-danger']);
?>
<?php
echo $form->field($admin, 'name')->textInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('name')]);
?>
<?php
echo $form->field($admin, 'password')->passwordInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('password')]);
?>
<?php
echo $form->field($admin, 'email')->textInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('email')]);
?>
<?php
echo \yii\bootstrap\Button::widget(['id' => 'backButton', 'label' => Icon::show('arrow-circle-left') . Yii::t('install', 'Back'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-info', 'onClick' => new \yii\web\JsExpression("\n \$('#stepsMenu a:eq({$previousStep})').click();\n return false;")]]);
echo Html::a(Icon::show('arrow-circle-right') . Yii::t('install', 'Continue'), '', ['class' => 'btn btn-info', 'style' => 'margin-left: 10px;', 'onClick' => new \yii\web\JsExpression("\n \$('#Administrator').submit();\n return false;")]);
?>
</div>
示例7:
use yii\helpers\Html;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
use kartik\form\ActiveForm;
use yii\bootstrap\Modal;
use kartik\sortable\Sortable;
use kartik\select2\Select2;
use kartik\dynagrid\Module;
$module = Module::fetchModule();
$listOptions = ['class' => 'form-control dynagrid-detail-list'];
$data = $model->getDtlList();
if (count($data) == 0) {
$listOptions['prompt'] = Yii::t('kvdynagrid', 'Select...', ['category' => $model->category]);
}
$dataConfig = print_r($model->data, true);
$form = ActiveForm::begin();
echo $form->field($model, 'name', ['addon' => ['append' => ['asButton' => true, 'content' => Html::button('<span class="glyphicon glyphicon-ok"></span>', ['title' => Yii::t('kvdynagrid', 'Save'), 'class' => "dynagrid-detail-save btn btn-primary"]) . Html::button('<span class="glyphicon glyphicon-remove"></span>', ['title' => Yii::t('kvdynagrid', 'Delete'), 'class' => "dynagrid-detail-delete btn btn-danger"])]]])->textInput(['class' => 'form-control dynagrid-detail-name'])->hint(Yii::t('kvdynagrid', "Set a name to save the state of your current grid {category}. You can alternatively select a saved {category} from the list below to edit or delete.", ['category' => $model->category]));
echo $form->field($model, 'editId')->listBox($data, $listOptions);
//$form->field($model, 'dataConfig')->textArea(['class'=>'form-control dynagrid-settings-text', 'readOnly'=>true])
?>
<div class="dynagrid-settings-text"><?php
echo $model->getDataConfig();
?>
</div>
<?php
echo Html::activeHiddenInput($model, 'id', ['id' => $model->key]);
echo Html::activeHiddenInput($model, 'category');
echo Html::activeHiddenInput($model, 'storage');
echo Html::activeHiddenInput($model, 'userSpecific');
echo Html::activeHiddenInput($model, 'dynaGridId');
echo Html::hiddenInput('deleteDetailFlag', 0);
示例8:
use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\widgets\SwitchInput;
use yii\helpers\ArrayHelper;
use lukisongroup\models\master\Perusahaan;
use lukisongroup\models\hrd\Corp;
/* @var $this yii\web\View */
/* @var $model lukisongroup\models\esm\Suplier */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="suplier-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'method' => 'post', 'action' => ['master/suplier/simpan']]);
?>
<?php
//= $form->field($model, 'KD_SUPPLIER')->textInput(['maxlength' => true])
?>
<?php
$drop = ArrayHelper::map(Corp::find()->all(), 'CORP_ID', 'CORP_NM');
?>
<?php
echo $form->field($model, 'KD_CORP')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --'])->label('Group Perusahaan');
?>
<?php
echo $form->field($model, 'NM_SUPPLIER')->textInput(['maxlength' => true]);
示例9:
use lukisongroup\models\master\Kategori;
use lukisongroup\models\master\Unitbarang;
use lukisongroup\models\master\Suplier;
use lukisongroup\models\master\Perusahaan;
use lukisongroup\models\master\Tipebarang;
use lukisongroup\models\hrd\Corp;
use kartik\widgets\FileInput;
/* @var $this yii\web\View */
/* @var $model lukisongroup\models\master\Barangumum */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="barangumum-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
$drop = ArrayHelper::map(Corp::find()->all(), 'CORP_ID', 'CORP_NM');
?>
<?php
echo $form->field($model, 'KD_CORP')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --', 'disabled' => true])->label('Group Perusahaan');
?>
<?php
echo $form->field($model, 'KD_BARANG')->textInput(['maxlength' => true, 'readonly' => true]);
?>
<?php
echo $form->field($model, 'NM_BARANG')->textInput(['maxlength' => true]);
示例10:
<?php
use yii\bootstrap\Html;
use kartik\form\ActiveForm;
use kartik\builder\Form;
use kartik\switchinput\SwitchInput;
use yii\helpers\Url;
use frontend\packages\BootstrapTreeviewAsset;
BootstrapTreeviewAsset::register($this);
?>
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 3], 'enableAjaxValidation' => true, 'id' => 'frmBookingForm']);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 3, 'attributes' => ['title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Event title...']], 'description' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Event description...'], 'columnOptions' => ['colspan' => 2]]]]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['calendar_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ['0' => ''] + yii::$app->CalendarComponent->myCalendarList, 'options' => ['id' => 'calendar_id', 'placeholder' => 'Select a calendar']], 'project_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ['0' => ''] + yii::$app->ProjectComponent->myProjectList, 'options' => ['id' => 'project_id', 'placeholder' => 'Select a project']]]]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['start_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\datecontrol\\DateControl', 'options' => ['options' => ['id' => 'start_date']]], 'all_day_option_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => $model->allDayOptions]]]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['start_time' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\time\\TimePicker', 'options' => ['pluginOptions' => ['showMeridian' => false], 'options' => ['id' => 'start_time']]], 'end_time' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\time\\TimePicker', 'options' => ['pluginOptions' => ['showMeridian' => false], 'options' => ['id' => 'end_time']]]]]);
?>
<input type="hidden" name="_csrf" value="<?php
echo Yii::$app->request->getCsrfToken();
?>
" />
<?php
\kartik\form\ActiveForm::end();
?>
示例11: array
use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\touchspin\TouchSpin;
use app\models\InsightsContent;
/* @var $this yii\web\View */
/* @var $model app\models\InsightsDef */
/* @var $form yii\widgets\ActiveForm */
$items = array(null => '<i class="fa fa-ban"></i>', -2 => '<i class="fa fa-angle-double-down"></i>', -1 => '<i class="fa fa-angle-down"></i>', 0 => '-', 1 => '<i class="fa fa-angle-up"></i>', 2 => '<i class="fa fa-angle-double-up"></i>');
$counter = 0;
?>
<div class="insights-def-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['showLabels' => false, 'labelSpan' => 2, 'deviceSize' => ActiveForm::SIZE_LARGE]]);
?>
<div class="form-group kv-fieldset-inline">
<?php
echo Html::activeLabel($model, 'id_category', ['label' => 'Kategoria', 'class' => 'col-sm-1 control-label']);
?>
<div class="col-sm-2">
<?php
echo $form->field($model, 'id_category')->dropDownList($categories);
?>
</div>
<?php
echo Html::activeLabel($model, 'name', ['label' => 'Zapisane wnioski', 'class' => 'col-sm-1 control-label']);
?>
<div class="col-sm-8">
示例12:
<?php
use kartik\form\ActiveForm;
/** @var \backend\modules\ads\models\BannerForm $model */
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-ad-form', 'options' => ['data-pjax' => true]]);
echo $form->field($model, 'name'), $form->field($model, 'position')->dropDownList($model->possiblePositions), $form->field($model, 'enableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'disableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'code')->textarea(['style' => 'height: 30vh']), $form->field($model, 'state')->checkbox([], false), \yii\bootstrap\Html::tag('div', \yii\helpers\Html::button('Сохранить', ['class' => 'btn btn-success', 'type' => 'submit']), ['class' => 'text-center']);
$form->end();
示例13:
<?php
use yii\helpers\Html;
//use yii\widgets\ActiveForm;
use kartik\form\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\ProductType */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="product-type-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 2, 'deviceSize' => ActiveForm::SIZE_SMALL]]);
?>
<?php
echo $form->field($model, 'product_type')->textInput(['maxlength' => true]);
?>
<div class="form-group">
<div class="col-sm-2 col-md-2 col-lg-2"></div>
<div class="col-sm-10 col-md-10 col-lg-10">
<?php
echo Html::submitButton($model->isNewRecord ? '<i class="fa fa-save"></i> บันทึกข้อมูล' : '<i class="fa fa-pencil"></i> แก้ไข', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
<?php
echo Html::resetButton('<i class="fa fa-remove"></i> ยกเลิก', ['class' => 'btn btn-danger']);
?>
</div>
</div>
示例14:
* @copyright Copyright (c) 2015 kangqingfei
* @license MIT
*/
use kartik\form\ActiveForm;
use yii\helpers\Html;
/** @var common\models\LoginForm $loginModel */
$this->title = '登录';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="kblog-login col-xs-10 col-xs-offset-1 col-sm-8
col-sm-offset-2 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
<?php
//水平表单
$form = ActiveForm::begin([]);
?>
<div class="form-group ">
<?php
echo $form->field($loginModel, 'email', ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-envelope"></i>']], 'showLabels' => false])->textInput(['placeholder' => '请输入邮箱']);
?>
<?php
echo $form->field($loginModel, 'password', ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-lock"></i>']], 'showLabels' => false])->passwordInput(['placeholder' => '请输入密码']);
?>
<span style="float:left; margin-top:-10px">
<?php
echo $form->field($loginModel, 'rememberMe')->checkbox();
?>
</span>
<span style="float:right; margin-top:0px; margin-left:30px">
示例15:
],
]); ?>
<?= $form->field($model, 'sex')->dropdownList($model->sexList())?>
<?php ActiveForm::end(); ?>
</div>
<div class="user-head-pic">
<label>头像</label>
<img src="<?php echo $model->head_picture;?>" class="img-circle" width="80px" id="head_pic">
<span class="fa fa-refresh" onclick="changeHeadPic()" id="refresh">换一换</span>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 upload-head-pic">
<?php $form = ActiveForm::begin([
'options' => [
'class' => 'form-horizontal',
'enctype' => 'multipart/form-data',
],
]); ?>
<?= $form->field($model, 'head_picture')->label(Yii::t('app', 'Upload Head Picture'))->widget(FileInput::classname(), [
'pluginOptions' => [
'uploadUrl' => Url::to(['/user/upload-head-pic']),
'uploadAsync' => false,
'allowedPreviewTypes' => ['image'],
'allowedFileExtensions' => ['png', 'jpg', 'jpeg'],
'maxFileCount' => 1,
'maxFileSize' => 1000,
'uploadExtraData' => [
'_csrf' => Yii::$app->request->csrfToken,
'User[id]' => $model->id,
]