Answer the question
In order to leave comments, you need to log in
How to hide input fields when selecting a specific radio in yii?
Here is the code:
<section class="who-pay">
<div class="container">
<div class="row">
<div class="col-12">
<div class="form-head"><h4>Кто будет оплачивать?</h4></div>
</div>
<div class="col-md-6 radio-wr">
<?php $form = ActiveForm::begin() ?>
<?php $orders->status = '0'; echo $form->field($orders, 'status')->radioList([
'0' => 'Физическое лицо',
'1' => 'Юридическое лицо',
],[
'item' => function($index, $label, $name, $value){
return Html::radio($name, false, ['id' => 'id_' . $index, 'label' => $label]);
}
])->label(false);?>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
<?= $form->field($orders,'name')->textInput(['placeholder'=>'Введите свое имя']);?>
<?= $form->field($orders,'telephone')->textInput(['placeholder'=>'Введите номер телефона'])?>
<?= $form->field($orders,'email')->textInput(['placeholder'=>'Введите свой почтовый ящик'])?>
</div>
<div class="col-md-6 form-yur" id="yur">
<?= $form->field($orders,'organization')->textInput(['placeholder'=>'Введите название организации'])?>
<?= $form->field($orders,'inn')->textInput(['placeholder'=>'Введите ИНН'])?>
<?= $form->field($orders,'ogrn')->textInput(['placeholder'=>'Введите ОГРН'])?>
</div>
</div>
<?= Html::submitButton('Отправить', ['class' => 'btn'])?>
<?php ActiveForm::end()?>
</div>
</section>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question