getgrav / getgrav/grav-plugin-form

Single checkbox invalid input on required validation

Open
#549 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
64
Forks
80
Avg merge
10h 13m
Merged PRs (30d)
9

Description

### Problem
When a form contains a single checkbox with required validation, the server side validation returns an 'invalid input' message and the form cannot be submitted.

### Steps to reproduce
* Clean install Grav CMS 1.7.27.1
* Create form with [the example contact form code](https://learn.getgrav.org/16/forms/forms/example-form)
* Add terms of agreements checkbox code

```agree_to_terms:
type: checkbox
label: "Agree to the terms and conditions"
validate:
required: true
```

* Fill in the form in the frontend, check the agreements checkbox
* Validation never passes and message 'Invalid input in Agree to the terms and conditions' is displayed

### Expected result
Validation should pass when checkbox is checked and form should be submitted.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue in Grav CMS 1.7.27.1 with the example contact form and the shown required checkbox configuration, then trace the server-side validation handling for a single checked checkbox. Done means the checked checkbox passes required validation and the form submits without the “Invalid input” message.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.