I have a case where a field is mandatory, but not always mandatory. If I write the attribute as required in modal rules()
like: [['my_attribute'], 'required']
then it would make the field required in every case.
can I make a specific modal's attribute as required? in controller's or modal's custom function (i.e the place where I need the field to be mandatory).
P.S: i want to avoid jQuery and JavaScript. Please answer if there is a way in Yii2 to get it done :) thanks.