Фрагмент view:
Код: Выделить всё
<?php echo $form->field($model, 'findtype')->radioList([
'1' => 'по ИД',
'2' => 'по Email'
])->label('Выберите поле поиска'); ?>
<?php echo $form->field($model, 'text')->textInput()->label('и введите значение:'); ?>
Код: Выделить всё
[['text'], 'email', 'when' => function($model)
{
return $model->findtype == '2';
}],
[['text'], 'integer', 'when' => function($model)
{
return $model->findtype == '1';
}],