S
S
Sergey Beloventsev2017-10-20 15:17:15
Yii
Sergey Beloventsev, 2017-10-20 15:17:15

Validation by filling one of the three inputs?

there is a form

<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>

    <?= $form->field($model, 'text1')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'text2')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'text3')->textInput() ?>
<div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app','Создать') : Yii::t('app','Изменить'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

Is there a validation rule that specifies that only one of these three fields should be filled in. That is, if two or three fields are filled in, an error occurs

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