Yii2 And Cjuidialog / Ajax


what would be the yii2 way to do this ? :


I have two related tables:

Task                 Category

----                  -----

id                      id

name                category_name


I want to put a dropdown list in TASK’s _form view, and a button near to be able to create a new category in a modal popup window if needed

Spent quite a while on yii2 docs but can’t find the good info.

Many thanks for any advice on how to start solving this.


simple way… you may create 2 form field

  1. field select for available category

  2. field inputtext for new category

then in controller you may check inputtext if not empty… :)