IT Professional Services Inquiry - eSolia Tokyo
Thank You For Your Interest Please use the below form to make an enquiry about eSolia services or solutions, to ask questions, or to request more information. It is our pleasure to be of service, and we will respond as quickly as practical. If you experience technical issues with the form, please contact us directly at hello@esolia.co.jp or call +813-4577-3380. First Name * Last Name * Email * Message * Send Inquiry Submitting your inquiry... (function() { const form = document.getElementById('contact-form'); const submitButton = document.getElementById('submit-button'); const loadingEl = document.getElementById('form-loading'); const errorEl = document.getElementById('form-error'); const errorMessage = document.getElementById('error-message'); const fallbackContact = document.getElementById('fallback-contact'); // Capture referrer URL on page load const referrerField = document.getElementById('referrer-url'); if (referrerField && document.referrer) { referrerField.value = document.referrer; } function showFallbackContact() { fallbackContact.classList.remove('hidden'); } function validateField(fieldId, validator, errorMsg) { const field = document.getElementById(fieldId); const errorEl = document.getElementById(${fieldId}-error); const value = field.value.trim(); if (!validator(value)) { field.classList.add('border-red-500'); field.classList.remove('border-gray-300', 'dark:border-gray-600'); field.setAttribute('aria-invalid', 'true'); errorEl.textContent = errorMsg; errorEl.classList.remove('hidden'); return false; } else { field.classList.remove('border-red-500'); field.classList.add('border-gray-300', 'dark:border-gray-600'); field.setAttribute('aria-invalid', 'false'); errorEl.textContent = ''; errorEl.classList.add('hidden'); return true; } } const fields = { id: 'firstname', validator: (val) => val.length > 0, error: 'Please enter your first name' }, { id: 'lastname', validator: (val) => val.length > 0, error: 'Please enter your last name' }, { id: 'email', validator: (val) => /^(?!.\.\.)(?!.\.-)[a-zA-Z0-9@a-zA-Z0-9\.[a-zA-Z]{2,}$/.test(val), error: 'Please enter a valid email address' }, { id: 'message', validator: (val) => val.length > 0, error: 'Please enter a message' } ]; fields.forEach(field => { const input = document.getElementById(field.id); input.addEventListener('blur', () => { validateField(field.id, field.validator, field.error); }); }); form.addEventListener('submit', async function(e) { e.preventDefault(); let isValid = true; fields.forEach(field => { if (!validateField(field.id, field.validator, field.error)) { isValid = false; } }); if (!isValid) return; submitButton.disabled = true; submitButton.textContent = 'Sending...'; loadingEl.classList.remove('hidden'); errorEl.classList.add('hidden'); try { const formData = new FormData(form); const response = await fetch('/api/contact-submit', { method: 'POST', body: formData }); if (response.redirected) { window.location.href = response.url; } else if (!response.ok) { const errorText = await response.text(); throw new Error(errorText || 'Submission failed. Please try again.'); } } catch (error) { console.error('Form submission error:', error); errorMessage.textContent = error.message; errorEl.classList.remove('hidden'); submitButton.disabled = false; submitButton.textContent = 'Send Inquiry'; loadingEl.classList.add('hidden'); showFallbackContact(); } }); })();
by eSolia Inc.Reading Time: 5 min