getgrav / getgrav/grav-plugin-form
Form insists on redirecting after failure to validate
- Dominant language
- PHP
- Stars
- 64
- Forks
- 80
- Avg merge
- 10h 13m
- Merged PRs (30d)
- 9
Description
I added the custom anti-spam field provided by the [Cookbook](https://learn.getgrav.org/16/cookbook/general-recipes#make-a-custom-anti-spam-field-for-your-contact-form) on a working form, however it gets redirected to the form route when selecting a wrong answer, instead of showing the validate message "Not quite, try that math again".
The FrontMatter of the form:
```title: Contact
form:
fields:
name:
type: text
placeholder: Naam
display_label: false
classes: form50
validate:
required: true
email:
type: text
placeholder: E-mailadres
display_label: false
classes: form50
validate:
type: email
required: true
subject:
type: text
placeholder: Onderwerp
display_label: false
classes: form100
validate:
required: true
message:
type: textarea
placeholder: 'Jouw vraag of opmerking...'
display_label: false
validate:
required: true
min: 8
personality:
type: radio
label: 'What is five times eight?'
options:
alaska: 32
oklahoma: 40
california: 48
validate:
required: true
pattern: ^oklahoma$
message: 'Not quite, try that math again.'
buttons:
submit:
type: submit
value: 'Verstuur bericht'
classes: button-5
process:
email:
from: '{{ config.plugins.email.from }}'
from_name: '{{ form.value.name }}'
to: '{{ config.plugins.email.to }}'
reply_to: '{{ form.value.email }}'
subject: '[Contactaanvraag] BusinessA'
body: 'Contactpersoon:
{{ form.value.name }}
{{ form.value.email }}
{{ form.value.subject }}
Bericht:
{{ form.value.message }}'
save:
fileprefix: contact-
dateformat: Ymd-His-u
extension: txt
body: '{% include ''forms/data.txt.twig'' %}'
operation: create
redirect: /bedankt/contact
```
The form route in which the redirect is going to after failure of validate is: `/form/contact`
The form is working correctly when selecting the right answer, it only seems a problem when selecting the wrong answer.
Versions (latest as of now):
- Grav: v1.6.22
- Form: v4.0.5
- Email: v3.0.7
Edit1: markup.
Edit2: added version details
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.