我创建了三个字段,在表单对象中我启用了ajax验证。但我想在文件输入中禁用ajax验证。它没有用。
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data'],
'enableAjaxValidation' => true,
'formConfig'=>['labelSpan'=>6],
]);
echo Form::widget([
'model' => $model,
'form' => $form,
'columns' => 2,
'attributes' => [
'campaign_name' => ['type'=>Form::INPUT_TEXT,'enableAjaxValidation' => true,
'options'=>['placeholder'=>'Enter campaign name']],
'voiceFile' => ['type'=>Form::INPUT_WIDGET,
'widgetClass'=>'kartik\file\FileInput',
'enableAjaxValidation' => false,
'options'=>[
'options' => ['accept' => '.mp3,.wav,.ogg','placeholder'=>'Choose a Excel file'],'pluginOptions'=>['showPreview'=>true]
],
],]]);
echo Form::widget([
'model' => $model,
'form' => $form,
'columns' => 2,
'attributes' => [
'description' => ['type'=>Form::INPUT_TEXT,'enableAjaxValidation' => true, 'options'=>['placeholder'=>'Enter descritption']],
'Action' => ['type'=>Form::INPUT_RAW, 'value'=>Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary','style'=>'margin-top:25px']),],]
]);
ActiveForm::end();
?>
答案 0 :(得分:0)
要禁用验证,您必须使用
'enableClientValidation'=>false