Answer the question
In order to leave comments, you need to log in
How can I set a required field for a certain form?
I have a model where there are already mandatory lines, Let's say when saving or editing. And let's say my situation is such that if the order was rejected, then you need to specify the reason for the refusal, it must be mandatory, but if this is done in the model, then the data in the database will not be created and edited and everything is desirable to be in one table without creating with a new table. That is, I need to make only one required field in one form, I tried this
<?php $form = ActiveForm::begin([]); ?>
<?= $form->field($model, 'declined')->textInput(['required']) ?>
<?= Html::submitButton('Отправить', ['class' => 'btn btn-primary'])?>
<?php ActiveForm::end()?>
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