A
A
Alexander Gorkin2018-08-07 10:42:39
Yii
Alexander Gorkin, 2018-08-07 10:42:39

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>

What I just haven’t tried with both the css checked method and jquery. Nothing wants to work. I can't figure out what's wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question