<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use kartik\select2\Select2;
use kartik\datetime\DateTimePicker;
use kartik\date\DatePicker;
$this->registerCss("
.hint-block{
color:red;
}
");
?>
<div class="dummy-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model,'textInput')->textInput()->input('textInput',['value' => 'Initial Value']); ?>
<hr>
<?= $form->field($model, 'disabledTextInput')->textInput()->input('disabledTextInput',
['disabled' => true,
]) ?>
<hr>
<?= $form->field($model, 'readOnlyTextInput')->textInput()->input('readOnlyTextInput',
['readOnly' => true,
'value' => 'Initial Value',
]) ?>
<hr>
<?= $form->field($model, 'autoFocusTextInput')->textInput()->input('autoFocusTextInput',
['autoFocus' => true,
]) ?>
<hr>
<?= $form->field($model, 'textInputPlaceholderNolabel')->textInput()->input('textInputPlaceholderNolabel',
['placeholder' => 'Text Input With Placeholder and Without Label',
])
->label(false) ?>
<hr>
<?= $form->field($model, 'textFieldWithHint')->textInput()->hint('*) Ini adalah text input dengan hint') ?>
<hr>
<?= $form->field($model, 'dropDownList')->dropDownList([ 'Inactive', 'Active', ], ['prompt' => 'Select Status']) ?>
<hr>
<?= $form->field($model,'select2DropDown')->widget(Select2::classname(),[
'data' => $countries,
'language' => 'en',
'options' => ['placeholder' => 'Select Country'],
'pluginOptions' => ['allowClear' => true],
]);
?>
<hr>
<?= $form->field($model,'select2DropDownMultiple')->widget(Select2::classname(),[
'data' => $countries,
'language' => 'en',
'options' => ['placeholder' => 'Select Countries','multiple' => true],
'pluginOptions' => ['allowClear' => true],
]);
?>
<hr>
<?php $model->radioList = '2';?>
<?= $form->field($model, 'radioList')->checkboxList($gender,
['item' => function ($index, $label, $name, $checked, $value){
return '<label class="radio-inline">' . Html::radio($name, $checked, ['value' => $value]) . $label . '</label>';}])
->label('<em>Radio List with Label and PreChecked</em>');
?>
<hr>
<?php $model->checkBox = [1,2];?>
<?= $form->field($model, 'checkBox')->checkboxList($countries)?>
<hr>
<?=DateTimePicker::widget([
'model' => $model,
'attribute' => 'dateTimePicker',
'options' => ['placeholder' => 'Kartik DateTimePicker'],
'pluginOptions' => [
'format' => 'yyyy-mm-dd hh:ii:ss',
'autoclose' => true,
'todayHighlight' => true
]
]); ?>
<hr>
<?=$form->field($model, 'datePicker')->label(false)->widget(DatePicker::className(),[
'model' => $model,
'attribute'=>'datePicker',
'options' => ['placeholder' => 'Kartik DatePicker'],
'pluginOptions' => [
'format' => 'yyyy-mm-dd',
'autoclose' => true,
'todayHighlight' => true,
]
]); ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>