Y
Y
Yaroslav Studenikin2021-01-11 11:54:14
Yii
Yaroslav Studenikin, 2021-01-11 11:54:14

Yii2 dependent dropdownlist with different models?

The question arose of implementing two dependent dropdown lists in yii2 with two different models/tables. In short: there is a "Discount" entity, in the first dropdownlist I display two types of discounts:
1. By customers
2. By manufacturer
(ActiveForm (<?= $form->field($model, 'id_type_discount')->dropDownList... ) )
For communication there is a table "discount_type". The problem is that when choosing a discount type in select, it is necessary to load the list either from the clients table or from the brands table. And these are different entities. Googled, on dropdown only examples with parent lists, the same model. There is a slightly different logic here. Tell me how to correctly implement a similar structure in yii

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question