HI all! I’m trying to build a contact form for a B&B, using the default example in Grav documentation.
It is all working, except the type: number field. If I put the number of Adults or children or nights either using the arrows or writing it directly in the field I have an error message (see attachment).
Here is my code
title: 'Contact Form'
process:
markdown: true
twig: true
routable: true
visible: true
form:
name: my-contact-form
fields:
-
name: name
label: Name
placeholder: 'Enter your name'
autofocus: 'off'
autocomplete: 'off'
type: text
validate:
required: true
-
name: email
label: Email
placeholder: 'Enter your email address'
type: text
validate:
rule: email
required: true
-
type: date
label: 'Arrival date'
validate.min: '2022-01-01'
validate.max: '2050-12-31'
required: true
-
type: number
name: nights
label: 'Number of Nights'
validate:
min: 1
max: 30
step: 1
required: true
-
type: number
name: adults
label: Adults
validate:
min: 1
max: 4
step: 1
required: true
-
type: number
name: children
label: Children
validate:
min: 0
max: 4
step: 1
required: true
-
type: textarea
name: message
label: Message
size: long
placeholder: 'Enter your message'
validate:
required: true
-
name: honeypot
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.'
-
name: terms
label: '<a href=''#'' target=''blank''>Please accept our privacy policy</a>'
type: checkbox
markdown: true
validate:
required: true
buttons:
-
type: submit
value: Submit
process:
-
email:
from: '{{ form.value.email }}'
to: '{{ config.plugins.email.from }}'
subject: '[Contact] {{ form.value.name|e }}'
body: '{% include ''forms/data.txt.twig'' %}'
-
save:
fileprefix: contact-
dateformat: Ymd-His-u
extension: txt
body: '{% include ''forms/data.txt.twig'' %}'
-
message: 'Message sent.Thank you for contacting us!'
-
display: thankyou
cache_enable: false
All the fields are ok, but the numeric ones are reported as not filled.
Working in localhost, with Grav 1.7.29 Admin 1.10.29 Gantry 5.5.9 Helium theme 5.5.9