Modular form error validation


#1

I am struggling to customize the contact form with the Skeleton Agency theme to work. The contact form works out-of-the-box. I am getting tons of spams emails, so I have added the honeypot, but that isn’t working too well. Someone on here suggest blocking links in the textarea box.

I have added the validation pattern for not allowing links in the textarea. This works; however, the form does not give an error message. The user maybe confused thinking the form was send successfully which it did not.

snippet of my modular.md file

<...some text above>
form:
name: inquiry
action: /home
cache_enable: false
fields:
	- name: name
	  label: Name
	  placeholder: 'Enter your name'
	  autocomplete: 'on'
	  type: text
	  validate:
		required: true

	- name: email
	  label: Email
	  placeholder: 'Enter your email'
	  type: text
	  validate:
		rule: email
		pattern: "^\w([\w\.+-]*[\w-])?@([\w-]+\.)+[a-z]{2,5}$"
		required: true

	- name: message
	  label: Message
	  size: long
	  placeholder: Your message. No links.
	  type: textarea
	  validate:
		pattern: '^((?!https?:\/\/)(?:\R|.))*$'
		required: true
		message: No links allowed.

buttons:
	- type: submit
	  value: Submit
	  class: submit

process:
	- email:
		from: '{{ config.plugins.email.from }}'
		to:
		  - '{{ config.plugins.email.to }}'
		  - '{{ form.value.email }}'
		subject: '[Inquiry] {{ form.value.name|e }}'
		body: '{% extends ''email/base.html.twig'' %}'
	- save:
		fileprefix: inquiry-
		dateformat: Ymd-His-u
		extension: txt
		body: '{% include ''forms/data.txt.twig'' %}'
	- message: 'You will receive a reply shortly!'
	- display: thankyou

	<...some text below>