Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8612101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:32:39+00:00 2026-06-12T04:32:39+00:00

I have a Django application that allows people to create a record. A record

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:32:40+00:00Added an answer on June 12, 2026 at 4:32 am

    I suggest you take a look at formsets instead of reinventing this one.

    https://docs.djangoproject.com/en/dev/topics/forms/formsets/

    from django.forms.formsets import formset_factory
    
    FormSet = formset_factory(MyForm, extra=2)
    formset = FormSet()
    print formset.forms # you will see it is a collection of MyForm objects
    

    You can dynamically add / remove formsets by modifying a the “management form” and adding the next form (you can copy {{ formset.empty_form }} and modify the IDs to be the N-th form) and there are many examples online of how to do so:

    How would you make a dynamic formset in Django?
    Dynamically adding a form to a Django formset with Ajax

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django application that defines a one-to-many model relationship. The models look
I have an application that uses Django 1.3 installed in python's site-packages. I want
I'm new to Django, but the application that I have in mind might end
I have a web application build in Django + Python that interact with web
I have some unit tests I've written to test my Django application. One test
I'm currently writing an application that allows one to store images, and then tag
I have a python/django application that runs on the google app engine. My views.py
I have a Django application which allows different kinds of users: firms, administrators, external
I want to make an application that will allow people to form groups to
I have a django application using mod_python, fairly typical configuration except that media files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.