Hi everybody,
Update: Improved readability of snippet
I have a question about forms that are used by visitors of the website. When this visitor enters the information in the form but a field inside the form is invalid. After the user has updated the invalid field and tries to resubmit. It shows this message: “This form has already been submitted.”. I cannot submit this form unit I go to another page and go back to the form.
I have been looking in the PHP files that show this message and found that there is an id set that checks if it is a new or old form/submission. This is what my file looks like:
---
title: Contact
form:
name: contact-form
fields:
name:
label: Name
placeholder: 'Enter your name'
autocomplete: 'off'
type: text
validate:
required: true
company:
label: Company name
placeholder: 'Enter your company name'
type: text
validate:
required: false
email:
label: Email
placeholder: 'Enter your email address'
type: email
validate:
required: true
phoneNumber:
label: Phone number
placeholder: 'Enter your phone number address'
type: tel
validate:
required: false
demoSubject:
type: checkboxes
label: Select a subject
default:
option-one: false
option-two: false
options:
option-one: CrisisSuite
option-two Social media trainer
use: keys
validate:
required: true
classes: checkboxes
g-recaptcha-response:
type: captcha
label: Captcha
recaptcha_not_validated: 'Captcha is not valid'
buttons:
submit:
type: submit
value: Submit
classes: primary-button
process:
captcha: true
email:
from: '{{ config.plugins.email.from }}'
to: '{{ config.plugins.email.to }}'
subject: 'some message'
body: "{% include 'forms/data.html.twig' %}"
redirect: en/contact/thankyou
---
Does anybody know how I can resolve this isuee?
I am using Grav version: 1.7.3 and PHP version: 7.4.14. This is a modular contact form. Any suggestions are welcome and I can give more information if needed