Adding The Same Input Field Multiple Times With Jquery/ajax

Hello Guys,

I will explain my doubt with a little example: I have the person model, and this model have one relation with model Contact (has_many), in other words, one person can have mutiple contacts (phone/email).

My first question is:

If i am interested in show only one contact information, how i can load this information in update action? OBS: if i use “Person::model()->with(‘contacts’)->findByPk($id);” i will retrieve various contacts.

My second question is:

How i can add multiple input fields (the user need do this dynamically) and save them in the database?