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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:47:55+00:00 2026-06-10T11:47:55+00:00

I am new to django and I didnt know that it included a forms

  • 0

I am new to django and I didnt know that it included a forms library. I have written a dynamic form in html and javascript that shows checkboxes and if clicked, they display more input fields.

I am wondering if there is an easy way to adapt the code that I have already written to use django’s forms library since it is so much easier and cleaner to access the form’s data with djangos built-in methods.

Also, if i want the form to be dynamic do I need to use formset or does the form library have those capabilities?

Here is the code I would like to convert to use the Forms library:

<script language="javascript"> 
        function ifChecked(id, id2){
        var ele = document.getElementById(id);
        var ele2 = document.getElementById(id2);

        if(ele.checked){
            ele2.style.display = "block";
        }
        else{
            ele2.style.display = "none";
        }
    }

    function ifCheckedLine(id, id2){
        var ele = document.getElementById(id);
        var ele2 = document.getElementById(id2);

        if(ele.checked){
            ele2.style.display = "inline";
        }
        else{
            ele2.style.display = "none";
        }
    }
</script>

<body>
<form name="myform" action="resultsget" method = "get" >            
        <fieldset>
            <input type="checkbox" value="total_money" id = "money_check" name="check" onchange="javascript:ifChecked('money_check','money');" /> Filter by Total Money</br>

                <div id="money" style="display:none" name="option">  

                    <input type="checkbox" value="more" id="money_condition" onchange="javascript:ifCheckedLine('money_condition', 'money_text');"  name="condition"/> <label for="condition" > > </label>

                        <div id = "money_text" style="display:none"  >
                            <input type="text" id="money_box" name="money_name" value="lower limit" />
                        </div></br>

                    <input type="checkbox" value="less" id="money_condition1" onchange="javascript:ifCheckedLine('money_condition1', 'money_text1');" name="condition"/> <label for="condition1"> < </label>

                        <div id = "money_text1" style="display:none;"  >
                            <input type="text" id="money_box1" name="money_name1" value="upper limit" />
                        </div>

                </div> 
</fieldset>

    <input type="submit" value="Submit" />
</form>​

I would also like to know what I have to put in my views.py file to read the form information

Thanks!!

  • 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-10T11:47:56+00:00Added an answer on June 10, 2026 at 11:47 am

    With django forms you can build a form with fields that you want and using template render it.
    Processing of a form will become easy when you build a django form. Refer Working with forms

    For dynamic enabling/disabling fields, the code you have written can be used with a change that use ‘id’ that django puts in for form field. I will suggest to use jQuery to set event handlers for the elements.

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

Sidebar

Related Questions

I have an existing PostgreSQL database that I'm using for a new Django site.
I have a new Django 1.3 project and app that I've created. I added
Brand new to django. We have a legacy django project using django 0.96x that
I have a general question about the new Django 1.3 static file framework. I
I'm new with Django and python. I have a problem. Is there a way,
I wrote a certain function that I'd like all my Django models to have.
I'm really new to django and I'm building a form and I need a
I have a new django project called mysite. Inside mysite is a folder called
In the new Django 1.4 project layout, I have a declaration of os.environ.setdefault on
I'm new to Django deployment and I want to know what are the steps

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.