1. 程式人生 > >Yii2表單常用方法

Yii2表單常用方法

$form->field($model, 'type')->dropDownList(['0' => '選擇拍賣型別', '1' => '拍場', '2' => '拍品']);
$form->field($model, 'id')->textarea(['placeholder' => '請輸入拍場id或者拍品id']);
$form->field($model, 'uid')->textarea(['placeholder' => '請輸入新增白名單使用者id,多個用逗號分隔']);
Html::button('初始化', ['class' => 'btn btn-danger init']);
Html::button('查詢', ['class' => 'btn btn-default query']) 
日曆用法精確到時分秒
use kartik\datetime\DateTimePicker;
<?= $form->field($model, 'start_time')->widget(DateTimePicker::classname(), [
         'options' => ['placeholder' => '請選擇日期'],
         'pluginOptions' => [
             'autoclose' => true
         ]
  ]);
?>