I have a Django application that allows people to create a record. A record can contain one or more people and the form by default contains three fields to capture a person's name. One for first name, one for middle initial and one for last name. When a person is creating a record they can add additional people by clicking a plus button. The plus button adds another set of three text boxes. They can do this for as many people as they want to add.
Once they click the plus button a minus button shows up next to each row so they can remove those fields if they decide to.
What is the best way to name the text fields so that I can get all the text fields and iterate through them in the back end of the application?
I thought if I named them all the same I would get an array of names when I do:
request.POST.getlist('firstname')
However, that is not the case. Instead I get the value from the last input field with that name.
Any suggestions are appreciated.