grav-plugin-form icon indicating copy to clipboard operation
grav-plugin-form copied to clipboard

Checkbox value still not submitted

Open bwhb opened this issue 3 years ago • 1 comments

Hi, when sending a form, the checkbox value is not submited. I am using version 4.3.0.

Here is an example of my uses yaml:

---
title: Probleme auf der Website
mail: true
form:
    name: problemewebsite
    action: /kontakt#probleme-auf-der-website
    fields:
        - 
          type: fieldset
          legend: Problem senden:
          fields:
              - 
                name: name
                id: nameprobleme
                label: 'Vorname und Nachname'
                classes: 'form-control'
                placeholder: Vor- und Nachname
                autocomplete: on
                type: text
                validate:
                  required: true
              - 
                name: email
                id: emailprobleme
                label: 'E-Mail Adresse (Beispiel: [email protected])'
                classes: 'form-control'
                placeholder: [email protected]
                type: email
                validate:
                  required: true
              - 
                name: bereich
                label: 'Bereich'
                type: radio
                default: false
                options: 
                  technisches Problem: technisches Problem
                  Sonstiges: Sonstiges
                validate:
                  required: true
              - 
                name: problem
                id: problemprobleme
                label: 'Problem'
                classes: 'form-control'
                type: textarea
                validate:
                  required: true
              - 
                publish_date: 25.05.2018 00:00
                name: datenschutzeinwilligung
                type: checkbox
                label: "Ich habe die <a href='/datenschutz' target='_blank'>Informationen zum Datenschutz</a> zur Kenntnis genommen und willige in die Verarbeitung meiner personenbezogenen Daten ein."
                default: false
                validate:
                  required: true`
 buttons:
        -  
          type: submit
          classes: 'btn btn-primary'
          value: 'Problem senden'

    process:
        - email:
            from: "{{ config.plugins.email.from }}"
            to:
              - "webmaster@xxx"
              - "{{ form.value.email }}"
            reply_to: "webmaster@xxx"
            subject: "[Feedback] {{ form.value.name|e }}"
            body: "{% include 'forms/data.html.twig' %}"
        - display: vielen-dank
---

bwhb avatar Dec 29 '20 09:12 bwhb

HTML checkboxes only send a value when 'checked', they don't send anything when empty.

https://www.w3schools.com/jsref/prop_checkbox_value.asp

rhukster avatar Jan 04 '21 18:01 rhukster