A
A
Alexander Sinitsyn2016-12-13 15:09:43
Yii
Alexander Sinitsyn, 2016-12-13 15:09:43

How to tell ActiveForm which script to use for client-side validation?

There are several fields in the form, which, depending on the status of the record, are either required or not. But the form, not knowing this, requires them constantly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2016-12-13
@a_u_sinitsin

The script cannot be defined in ActiveForm. it is picked up from the model that is used.
Accordingly, in order for ActiveForm to pull up the necessary validation rules, you need to install a script for the model used, for example:
$model->scenario = 'my-scenario';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question