Hello everyone,
I’m currently trying to implement a contact form on my website, but I’m running into several issues and can’t seem to get it working properly.
I’ve already tried multiple approaches and even asked tools like Claude and ChatGPT, but unfortunately I haven’t found a solution yet.
The main problems are:
- I can’t get the theme to work correctly with the form
- The form does not process requests as expected
- When I submit the form, I receive the following error message:
"Call to undefined method RuntimeException::getMessages()"
As I’m still quite new to programming, I might be overlooking something basic.
Does anyone have an idea what could be causing this or how to fix it?
Thanks a lot in advance!
Contents of form.md:
---
title: 'Kontakt'
template: kontakt
description: 'contact me'
form:
name: kontaktformular
fields:
vorname:
label: Vorname
type: text
validate:
required: true
nachname:
label: Nachname
type: text
validate:
required: true
email:
label: E-Mail
type: email
validate:
required: true
telefon:
label: Telefon
type: text
nachricht:
label: Nachricht
type: textarea
validate:
required: true
buttons:
submit:
type: submit
value: Absenden
process:
email:
subject: "Neue Kontaktanfrage von {{ form.value.vorname|e }} {{ form.value.nachname|e }}"
body: "{% include 'forms/data.html.twig' %}"
message: 'Danke für deine Nachricht!'
reset: true
---
# Kontakt
Contents of kontakt.html.twig:
{% extends 'partials/base.html.twig' %}
{% block content %}
<section class="page-hero">
<div class="container" data-aos="fade-up">
<h1>Kontakt</h1>
<p>Wir freuen uns auf Ihre Nachricht</p>
</div>
</section>
<section class="kontakt-section">
<div class="container">
<div class="kontakt-grid">
<div class="kontakt-info" data-aos="fade-right">
<h2>Kontaktdaten</h2>
<div class="info-item">
<span class="info-icon">🏢</span>
<div>
<strong>COMPANY</strong>
<p>NAME</p>
</div>
</div>
<div class="info-item">
<span class="info-icon">📍</span>
<div>
<strong>Adresse</strong>
<p>STREET<br>TOWN</p>
</div>
</div>
<div class="info-item">
<span class="info-icon">📞</span>
<div>
<strong>Telefon</strong>
<p><a href="tel:0123456">0123456</a></p>
</div>
</div>
<div class="info-item">
<span class="info-icon">✉️</span>
<div>
<strong>E-Mail</strong>
<p><a href="mailto:[email protected]">[email protected]</a></p>
</div>
</div>
</div>
<div class="kontakt-form" data-aos="fade-left">
{{ forms(page.header.form).render()|raw }}
</div>
</div>
</div>
</section>
{% endblock %}