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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:51:32+00:00 2026-05-23T15:51:32+00:00

I have a large django form. It has a lot of data that depends

  • 0

I have a large django form. It has a lot of data that depends on a field being selected.

Eg:

Do you have a car? YES/NO dropdown box.

If yes, I want to show the additional fields make/model/year/cc etc etc

If no, I want to keep them hidden.

What is the best way to this? A simple show/hide div using jquery or is there something better that I should be doing?

  • 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-23T15:51:33+00:00Added an answer on May 23, 2026 at 3:51 pm

    Yes, you should use a simple show/hide with JQuery on the client side.
    Then on the server side, you would need conditional validation in your form’s clean method, if you also want to make some fields required only if something else is selected.

    For example:

    class MyForm(Form):
        ...
        def clean(self):
            cleaned_data = self.cleaned_data
            has_car_required_fields = ['foo', 'bar', 'baz']
            if cleaned_data.has_key('has_car') and cleaned_data['has_car']:
                for field_name in has_car_required_fields:
                    if not cleaned_data.has_key(field_name) or not cleaned_data[field_name]:
                        self._errors[field_name] = ErrorList([_(u'This field is required')])
    
             return cleaned_data
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application in Django, that needs to send a large number of
Suppose you have a Django view that has two functions: The first function renders
I'm starting on my first large django project and have realized that the default
I have designed a django app that will plot and export large chunks of
I am building a Django powered web app that has a large database component.
I have a large data set of Course objects in a Django application. courses
I have inherited a large Django application and it features this idiom in the
i have large numbers of text files and i am in problem that i
I have large video files (~100GB) that are local on my machine. I have
I have a page which displays a form that a logged-in user can use

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.