Class Selection Dropdown

Hi all,

I try to have three models:




Each Nswitchport and Patchpanelport has a foreign key port_id to link to a port. And each port hasOne nswitchport and hasOne patchpanelport.

The forth model patchcable has two port_ids. Now I want to make a selector in the patchcable-form for the port_ids. I thought about two dependent dropdown lists:

First Dropdown: Type (Switchport or Patchpanelport)

Second Dropdown: Port

I know I could make the first dropdown static with the two types, but I would prefer to fill it dynamic. So I need a function to get the class name of a port. Is there a "Yii2" way to do that?

Thank you a lot!


u can use kartik dependent dropdown.

ref link click here

Rups g