contact-form/templates/contact_form.askama.html

93 lines
3.2 KiB
HTML
Raw Normal View History

2022-11-01 19:45:06 +00:00
{% extends "base.askama.html" %}
2022-10-29 15:12:29 +00:00
{% block body %}
2022-12-03 16:08:23 +00:00
<p>{{ strings.description }}</p>
<h2>{{ strings.title }}</h2>
2022-10-29 15:12:29 +00:00
2022-11-06 20:24:30 +00:00
<form id="contact-form"
2022-12-17 17:37:04 +00:00
action="{{ base.path_prefix }}/"
2022-11-06 20:24:30 +00:00
method="post"
2022-12-03 16:08:23 +00:00
{% if was_validated %} class="was-validated"{% endif %}
2022-11-06 20:24:30 +00:00
novalidate>
2022-10-29 15:12:29 +00:00
<input type="hidden" name="id" value="{{ id }}" required>
<div class="mb-3">
2022-12-03 16:08:23 +00:00
<label for="name" class="form-label">{{ strings.name_field.label }}</label>
2022-11-06 20:24:30 +00:00
<input type="text"
name="name"
value="{{ name }}"
class="form-control"
id="exampleInputEmail1"
required>
2022-12-03 16:08:23 +00:00
<div class="invalid-feedback">{{ strings.name_field.invalid_feedback }}</div>
2022-10-29 15:12:29 +00:00
</div>
<div class="mb-3">
2022-12-03 16:08:23 +00:00
<label for="email" class="form-label">{{ strings.email_field.label }}</label>
2022-11-06 20:24:30 +00:00
<input type="email"
name="email"
value="{{ email }}"
class="form-control"
id="email"
required>
2022-12-03 16:08:23 +00:00
<div class="invalid-feedback">{{ strings.email_field.invalid_feedback }}</div>
2022-10-29 15:12:29 +00:00
</div>
<div class="mb-3">
2022-12-03 16:08:23 +00:00
<label for="telefon" class="form-label">{{ strings.telefon_field_label }}</label>
2022-11-06 20:24:30 +00:00
<input type="text"
name="telefon"
value="{{ telefon }}"
class="form-control"
id="telefon">
2022-10-29 15:12:29 +00:00
</div>
<div class="mb-5">
2022-12-03 16:08:23 +00:00
<label for="message" class="form-label">{{ strings.message_field.label }}</label>
2022-12-17 17:37:04 +00:00
<textarea name="message"
rows="5"
class="form-control"
id="message"
style="resize: none"
required>{{ message }}</textarea>
2022-12-03 16:08:23 +00:00
<div class="invalid-feedback">{{ strings.message_field.invalid_feedback }}</div>
2022-10-29 15:12:29 +00:00
</div>
2022-10-27 16:44:40 +00:00
2022-10-29 15:12:29 +00:00
<div class="mb-3">
<img src="data:image/png;base64,{{ captcha }}">
</div>
<div class="mb-3">
2022-12-03 16:08:23 +00:00
<label for="captcha_answer" class="form-label">{{ strings.captcha_field.label }}</label>
2022-11-06 20:24:30 +00:00
<input type="text"
name="captcha_answer"
class="form-control"
id="captcha_answer"
required>
2022-12-03 16:08:23 +00:00
<div class="invalid-feedback">{{ strings.captcha_field.invalid_feedback }}</div>
2022-10-29 15:12:29 +00:00
</div>
2022-10-26 00:23:55 +00:00
2022-12-03 16:42:25 +00:00
{% if error_message.len() > 0 %}
<div class="alert alert-warning" role="alert">{{ error_message }}</div>
{% endif %}
2022-10-29 15:12:29 +00:00
<div class="d-grid">
2022-12-03 16:08:23 +00:00
<button type="submit" class="btn btn-primary">{{ strings.submit }}</button>
2022-10-29 15:12:29 +00:00
</div>
</form>
{% endblock %}
{% block scripts %}
<script>
"use strict";
2022-12-03 16:08:23 +00:00
const form = document.querySelector("form#contact-form");
2022-10-29 15:12:29 +00:00
form.addEventListener("submit", (event) => {
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
}
2022-12-03 16:08:23 +00:00
2022-10-29 15:12:29 +00:00
form.classList.add("was-validated");
});
</script>
{% endblock %}