#105_kontaktformular #121
@ -907,6 +907,7 @@ hr.-even {
|
||||
height: 12em;
|
||||
}
|
||||
|
||||
.contact_form__subject,
|
||||
.contact_form__message,
|
||||
.contact_form__name,
|
||||
.contact_form__email,
|
||||
|
@ -1,6 +1,7 @@
|
||||
const ajaxUrl = 'https://spielwiese.wtf-eg.de/php/contact_form.php';
|
||||
// const submit_button = document.getElementsByClassName('contact_form__submit_button')[0];
|
||||
const contact_form = document.getElementsByClassName('content__contact_form')[0];
|
||||
const subject = document.getElementsByClassName('contact_form__subject')[0];
|
||||
const message = document.getElementsByClassName('contact_form__message')[0];
|
||||
const name = document.getElementsByClassName('contact_form__name')[0];
|
||||
const email = document.getElementsByClassName('contact_form__email')[0];
|
||||
@ -26,6 +27,7 @@ contact_form.addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
let formData = new FormData();
|
||||
formData.append('action', 'handle_form');
|
||||
formData.append('subject', subject.value);
|
||||
formData.append('message', message.value);
|
||||
formData.append('name', name.value);
|
||||
formData.append('email', email.value);
|
||||
|
@ -63,11 +63,12 @@ function prepare_response() {
|
||||
$response['errors'][] = 'Wir glauben du bist ein Bot.';
|
||||
}
|
||||
if (!array_key_exists('errors', $response)) {
|
||||
$subject = sanitize_text('subject');
|
||||
$message = sanitize_text('message');
|
||||
$name = sanitize_text('name');
|
||||
$email = sanitize_text('email');
|
||||
|
||||
if (!send_message_to_office($message, $name, $email)) {
|
||||
if (!send_message_to_office($subject, $message, $name, $email)) {
|
||||
$response['errors'][] = 'Deine Nachricht konnte nicht übermittelt werden.';
|
||||
} else {
|
||||
$response['status'] = 'ok';
|
||||
|
@ -25,6 +25,10 @@
|
||||
Deine E-Mail-Adresse wird nicht veröffentlicht.<br>
|
||||
<span aria-hidden="true">Erforderliche Felder sind gekennzeichnet <span class="contact_form--required" aria-hidden="true">*</span></span>
|
||||
</p>
|
||||
<p class="contact_form__text_input">
|
||||
<label for="name">Betreff <span class="contact_form--required" aria-hidden="true">*</span></label>
|
||||
<input id="name" class="contact_form__subject" name="subject" type="text" value="" size="30" maxlength="245" required />
|
||||
</p>
|
||||
<p class="contact_form__textarea">
|
||||
<label for="message">Nachricht <span class="contact_form--required" aria-hidden="true">*</span></label>
|
||||
<textarea id="message" class="contact_form__message" aria-label="message" aria-hidden="true" cols="65" rows="7" name="message" required></textarea>
|
||||
|
Loading…
Reference in New Issue
Block a user