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

  • Home
  • SEARCH
  • 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 6970471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:42:52+00:00 2026-05-27T16:42:52+00:00

I have problem on accessing the form data from a formset. I attached the

  • 0

I have problem on accessing the form data from a formset. I attached the code:

####FORM
class ActionTypeForm(forms.Form):
     action_name = models.CharField(max_length=20)
     description = models.CharField(max_length=250, blank=True, null=True)


####VIEW
dataset = request.POST
ActionTypeFormSet = formset_factory(ActionTypeForm)
formset = ActionTypeFormSet(dataset)

if formset.is_valid():
     for form in formset.cleaned_data:  #I ALSO TESETED formset.forms
           customer.create_actiontype(form['action_name'], form['description'])

the error is I can’t get form[‘action_name’]. formset.is_valid() return True

ERROR

Exception Type: KeyError

Exception Value: ‘action_name’

POST DATA

form-0-action_name u’a’

form-2-description u’sadsa’

form-0-description u’a’

form-MAX_NUM_FORMS u”

form-1-description u’asd’

form-TOTAL_FORMS u’3′

form-1-action_name u’as’

form-INITIAL_FORMS u’0′

csrfmiddlewaretoken u’c4fa9ddb4ec69ac639d7801eb14979f2′

form-2-action_name u’asda’

  • 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-05-27T16:42:52+00:00Added an answer on May 27, 2026 at 4:42 pm

    The main problem is that you have a blank form. You are using model fields in your form class definition, which django’s forms framework has no idea what to do with. Django models != django forms.

    The formset is validating and returning empty forms which of course have no form fields.

    You should either create Formsets out of forms with valid form fields, or ModelFormsets out of Models.

    • Update: I initially thought that formsets don’t have cleaned_data, but I guess they do return a list of cleaned_datas of all forms, which means the problem with your code is just the above.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem accessing JSON data. I'm new to JSON and jquery so
I have problem accessing content from an Illustrator SWF(I create the swf using illustrator,
I have a problem accessing the 'event' in Firefox. The following code works fine
Hi I am still learning Jquery and have a problem accessing form elements. My
I am building my first ASP.Net MVC based app and have a problem accessing
i have problem with libhid . i found that there 2 way 4 accessing
I am having a problem accessing the ViewData object through javascript. I have set
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I'm quite new to JS and jQuery. I have a problem accessing the properties
I have problem with getting username form windows system. I tried using getlogin function

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.