feat: Added subject to contact form.
This commit is contained in:
parent
fb90e4933c
commit
bf2f5b3bde
@ -911,6 +911,7 @@ hr.-even {
|
|||||||
height: 12em;
|
height: 12em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.contact_form__subject,
|
||||||
.contact_form__message,
|
.contact_form__message,
|
||||||
.contact_form__name,
|
.contact_form__name,
|
||||||
.contact_form__email,
|
.contact_form__email,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const ajaxUrl = 'https://spielwiese.wtf-eg.de/php/contact_form.php';
|
const ajaxUrl = 'https://spielwiese.wtf-eg.de/php/contact_form.php';
|
||||||
// const submit_button = document.getElementsByClassName('contact_form__submit_button')[0];
|
// const submit_button = document.getElementsByClassName('contact_form__submit_button')[0];
|
||||||
const contact_form = document.getElementsByClassName('content__contact_form')[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 message = document.getElementsByClassName('contact_form__message')[0];
|
||||||
const name = document.getElementsByClassName('contact_form__name')[0];
|
const name = document.getElementsByClassName('contact_form__name')[0];
|
||||||
const email = document.getElementsByClassName('contact_form__email')[0];
|
const email = document.getElementsByClassName('contact_form__email')[0];
|
||||||
@ -26,6 +27,7 @@ contact_form.addEventListener('submit', function(event) {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append('action', 'handle_form');
|
formData.append('action', 'handle_form');
|
||||||
|
formData.append('subject', subject.value);
|
||||||
formData.append('message', message.value);
|
formData.append('message', message.value);
|
||||||
formData.append('name', name.value);
|
formData.append('name', name.value);
|
||||||
formData.append('email', email.value);
|
formData.append('email', email.value);
|
||||||
|
@ -63,11 +63,12 @@ function prepare_response() {
|
|||||||
$response['errors'][] = 'Wir glauben du bist ein Bot.';
|
$response['errors'][] = 'Wir glauben du bist ein Bot.';
|
||||||
}
|
}
|
||||||
if (!array_key_exists('errors', $response)) {
|
if (!array_key_exists('errors', $response)) {
|
||||||
|
$subject = sanitize_text('subject');
|
||||||
$message = sanitize_text('message');
|
$message = sanitize_text('message');
|
||||||
$name = sanitize_text('name');
|
$name = sanitize_text('name');
|
||||||
$email = sanitize_text('email');
|
$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.';
|
$response['errors'][] = 'Deine Nachricht konnte nicht übermittelt werden.';
|
||||||
} else {
|
} else {
|
||||||
$response['status'] = 'ok';
|
$response['status'] = 'ok';
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
Deine E-Mail-Adresse wird nicht veröffentlicht.<br>
|
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>
|
<span aria-hidden="true">Erforderliche Felder sind gekennzeichnet <span class="contact_form--required" aria-hidden="true">*</span></span>
|
||||||
</p>
|
</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">
|
<p class="contact_form__textarea">
|
||||||
<label for="message">Nachricht <span class="contact_form--required" aria-hidden="true">*</span></label>
|
<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>
|
<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