Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions resources/views/static/contact-us.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
@section('layout.breadcrumb')
@include('layout.breadcrumb', ['list' => $list])
@endsection
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>

<style>
@media (min-width: 768px) {
.hero-image {
Expand Down Expand Up @@ -177,11 +175,9 @@ class="w-8 h-8 bg-white rounded-lg border-2 border-blue-800 text-primary focus:r
</label>

<!-- CAPTCHA -->
@if (env('TURNSTILE_SITE_KEY') && env('TURNSTILE_SECRET_KEY'))
<div class="flex justify-center mt-6">
<div class="cf-turnstile" data-sitekey="{{ env('TURNSTILE_SITE_KEY') }}"></div>
</div>
@endif
<div class="flex justify-center mt-6">
<div class="cf-turnstile" data-sitekey="{{ env('TURNSTILE_SITEKEY') }}"></div>
</div>

<!-- Submit -->
<div class="flex justify-center mt-6">
Expand All @@ -194,7 +190,8 @@ class="flex gap-2 items-center px-8 py-4 text-base font-semibold leading-7 text-
</div>
</div>

<script>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=turnstileCallback" async defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const form = document.getElementById('contactForm');
const submitButton = document.getElementById('submitButton');
Expand All @@ -203,8 +200,8 @@ class="flex gap-2 items-center px-8 py-4 text-base font-semibold leading-7 text-
function validateForm() {
let allFilled = true;
requiredFields.forEach(field => {
if ((field.type === 'checkbox' && !field.checked) ||
(field.tagName === 'SELECT' && !field.value) ||
if ((field.type === 'checkbox' && !field.checked) ||
(field.tagName === 'SELECT' && !field.value) ||
((field.tagName === 'INPUT' || field.tagName === 'TEXTAREA') && !field.value.trim())) {
allFilled = false;
}
Expand All @@ -224,6 +221,16 @@ function validateForm() {
form.addEventListener('change', validateForm);
validateForm();
});
window.onload = function () {
window.turnstileCallback = function () {
turnstile.render('.cf-turnstile', {
sitekey: '{{ env('TURNSTILE_SITEKEY') }}',
callback: function(token) {
document.getElementById('cf-turnstile-response').value = token;
}
});
};
};
</script>
</div>
</section>
Expand Down
Loading