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 4612038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:20:58+00:00 2026-05-22T01:20:58+00:00

Ok, so I have a formset that is valid. But gives me a error

  • 0

Ok, so I have a formset that is valid. But gives me a error that that form has no attribute cleaned_data..

Honestly I have absolutely no clue what’s happening..
I tried my code on terminal and it returned a empty dictionary.. without errors..

forms:

class Clinical(forms.Form):
    _names = list(ClinicalForm.objects.values_list('form_id', 'form_name'))
    _names.append(("New", u'Nova entrada'))

    cliform_name = forms.ChoiceField(widget=RadioSelect(), choices=_names, label
         ="", required=True)

views:

ClinicalSet = formset_factory(Clinical, extra=2)

formset2 = ClinicalSet(request.POST)
if formset2.is_valid():
    choice1 = formset2.cleaned_data
    return render_to_response('valid_test.html', 
                                {
                                    'formset2': formset2,
                                    'wrongs1': wrongs1,
                                    'choice1': choice1 
                                    })
else:
    formset2 = ClinicalSet()
return render_to_response('valid_test.html', 
                            {
                                'formset2': formset2,
                                'wrongs1': wrongs1,
                                })    

template:

<form method="post" action="">
<div>
{{ formset2.management_form }}
    {% for form in formset2.forms %}
        {{ form }}
    {% endfor %} 
    <input type="submit" value="save" />
</div>

If I comment the line where the cleaned_data is called (choice1), I don’t receive any error and I’m able to see the forms..
If I select some options and uncomment this line, it works..

I have a similar formset : both forms in formset need to be selected and this one works..

the form that works is the first formset (linked above). The post parameters:

form-0-pres_name    1
form-1-pres_name    2
form-INITIAL_FORMS  0
form-TOTAL_FORMS    2

the user select one option in each form and he’s redirect to another view (this one – formset2).

Any help is more than welcome..

  • 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-22T01:20:59+00:00Added an answer on May 22, 2026 at 1:20 am

    formset_factory returns a form iterator, i.e. essentially a list of forms, it is not a form itself. cleaned_data is only available on the form, so you have to iterate over formset2:

    for form in formset2:
        form.cleaned_data # Here I am!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a formset that have two forms. forms: class PresClinicForm(forms.Form): _names = list(PresClinic.objects.values_list('pres_clinic_id',
I have a formset that contains five forms. Each form is simply a file
I have a form and a formset on my template. The problem is that
My problem is similar to Django Passing Custom Form Parameters to Formset Ive have
I have an edit object view that contains a formset(one or many if this
I have a ManyToManyField that I want to present in a form, as a
I have a Model Formset that should take files sent via POST and add
I have several formsets to which I am passing error_class es, but the formset
I currently have a form set up that passes some data to a php
I have activity records that have an inline formset showing appointments. I use the

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.