Model for a form that will have fields added via Javascript/JQuery

Hello,

I am making a form where teachers can register a new class (of students), the number of students can vary from class to class.  I wanted to give the user the ability to add students dynamically by using jQuery/Javascript to clone and append a specific part of the form.





I am really trying to make this form the "Yii" way, so I know that part of that is making a Model for the form.  I don't see anywhere in the docs where it mentions forms that change in size and how you factor them into your model.





Does anyone have any prior experiences doing a dynamic form this way?





Does anyone have any suggestions for what I should read to figure this out?

Thanks for your time.

I use the widget yii2-dynamicform and it works very nice.