mardi 17 mars 2020

Form checkbox states not showing in POST request (flask)

I'm writing a form in the html of a flask web app, and I can't get the request.form to show my checkboxes (radio button selection seems to work properly).

<form action="#" target="_blank" method="post" id="formulari">
    ...
    <div class="form-check">
        <input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
        <label class="form-check-label" for="defaultCheck1">
          Default checkbox
        </label>
    </div>
    <button type="submit" class="btn btn-primary" onclick="pdfgenerat()">Submit</button>
</form>

I have my radio buttons at ... and then this is just a random checkbox sample from the internet. When I print request.form I get the radio data (in my case ImmutableMultiDict([('curs', 'Dificultat al Gust')]) ) but there's nothing about the checkboxes. Oh, and I've also tried with text entries and they seem to work fine.

I guess I'm just lacking some base knowledge about forms, but I can't seem to find which it is.




Aucun commentaire:

Enregistrer un commentaire