H
H
hollanditkzn2017-06-26 14:37:56
Yii
hollanditkzn, 2017-06-26 14:37:56

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()?>

But something doesn't work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mi7teR, 2017-06-26
@Mi7teR

use scripts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question