我有一个带有动态字段的表格,并像这样输入
$ form-> field($ model_dt,“ [{$ lang ['id']}] [{$ i}] title”)-> textInput()
$ lang ['id']表示语言ID和附加行的$ i号。如何验证这样的输入?
<?php foreach (\common\models\Language::find()->all() as $lang) : ?>
<div class="container-items row justify-content-center mt-4 pt-4" id="slides-body-<?= $lang['id'] ?>">
<?php foreach ($model_data[$lang['id']] as $i => $model_dt): ?>
<div class="item panel panel-default col-lg-10 p-0 mt-2 align-self-center"><!-- widgetBody -->
<div class="panel-heading">
<h3 class="panel-title pull-left">Slide data #<?= $i.'-'.$lang['name'] ?></h3>
<div class="pull-right">
<button type="button" lang="<?= $lang['id'] ?>" class="add-item btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button>
<button type="button" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button>
</div>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-3">
<img src="<?= isset($model_dt[$lang['id']]) ? $model_dt[$lang['id']][$i]['name'] : '' ?>" style="max-width: 207px;" id="thumb-slides-<?= $lang['id'] ?>-<?= $i ?>-image">
<?= $form->field($model_dt, "[{$lang['id']}][{$i}]image")->widget(\mihaildev\elfinder\InputFile::className()) ?>
</div>
<div class="col-lg-3">
<?= $form->field($model_dt, "[{$lang['id']}][{$i}]title")->textInput() ?>
</div>
<div class="col-lg-3">
<?= $form->field($model_dt, "[{$lang['id']}][{$i}]desc")->textarea(['rows' => 3]) ?>
</div>
<div class="col-lg-3">
<?= $form->field($model_dt, "[{$lang['id']}][{$i}]button")->textInput() ?>
</div>
</div>
</div>
</div>
<?php $i++ ?>
<?php endforeach;?>
</div>
<?php endforeach; ?>