Validation can be disabled both on the client side (for yiiActiveForm) and on the server side.
Using a scenario will indicate that server-side validation should be skipped for certain fields.
On the client side, validation for specific fields will be dynamically removed depending on the selected action (in our case — delete).
Our controller:
$NewsletterMailForm = new NewsletterMailForm();
if(Yii::$app -> request -> post($NewsletterMailForm -> formName())['event'] != NewsletterMailForm::EVENT_DELETE)
{
$NewsletterMailForm -> scenario = NewsletterMailForm::EVENT_SEND;
}If the "event" field is not equal to "delete", it means we are going to send emails (no other actions are handled at this point).
