Yii Framework Forum

Dynamic ActiveForm based on DropDownList option


(armingdev) #1

Hello, I need help with ActiveForm a bit… I have a simple form in my view with few textInputs and save button… Its used for updating one of models … Now, i have to add an “dropDownList” also which should trigger some changes on my view (add some new textInputs based on selected item). here is an example:

DropDownList - select cars:
1 - BMW
2 - AUDI

Now based on that input from DropDownList, i have to render some more specific fields based on option select. For example:

If BMW is selected il need 2 more textInputs fields under.
if AUDI is selected il need some other 2 textInputs to show.

After I finish with that fields, i can hit my update button to write changes in db. I guess Il have to Pjax on this part with DropDownList and rendering this new fields in my form … Can any1 tell me what is best solution for this?