grav-plugin-form
grav-plugin-form copied to clipboard
Checkbox value still not submitted
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
---
HTML checkboxes only send a value when 'checked', they don't send anything when empty.
https://www.w3schools.com/jsref/prop_checkbox_value.asp