Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 73905

HTML Checkbox just returns None as value to my Django views

$
0
0

I have a very basic question. I created a checkbox form in HTML and I want to pass the Checkbox data to my Django views. Now I have the problem, that i just get returned None as a value and i don't know why.

HTML code:

<div class="form-group">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="checkbox" id="bb1">
            <label class="form-check-label" for="bb1">
            </label>
        </div>
    </div>

checkbox_input = request.GET.get("bb1")
    print(checkbox_input)

should't the output be something like "True", "False" or "on"? If I render my homepage and submit something, the link looks like this:

127.0.0.1:8000/?value=Hous&checkbox=on

Why can't I grab the value "on"?

I'm sorry I'm so sloppy about the way I phrase things here. I hope you guys can still help me :)


Viewing all articles
Browse latest Browse all 73905

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>