如何禁用yii2活动表单自动创建的表单方法和操作?
<div class="well">
<?php $form = ActiveForm::begin([
'action' => [''],'options' => ['method' => '']
]); ?>
<?= $form->field($model, 'Title')->textInput(['maxlength' => true, 'style'=>'width:300px']) ?>
<?= Html::button('Save', ['class' => 'btn btn-primary leavetype-save', 'value'=>'save']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
答案 0 :(得分:0)
不能通过参数。您需要覆盖public function dr($id)
{
$sql="SELECT * FROM tbl_delivery WHERE user_id = '$id'";
var_dump($sql);
$stmt = $this->dbh->prepare($sql);
$stmt->execute();
$data = array();
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
$data[] = $row;
}
return $data;
}
(尤其是run()
方法)并手动呈现不带yii\widgets\ActiveForm
和action
选项的表单。