jQuery(document).ready(function () { // Phone Number Input Fix setTimeout(function () { $('.iti input[type=tel]').css('padding-left', '100px'); }, 2000); var connectphoneInputField1 = document.querySelector("#wf-form-Consultation-Form-3 input[name='mobnum']"); window.connectphoneInput1 = window.intlTelInput(connectphoneInputField1, { hiddenInput: 'connect-mobnum-full', separateDialCode: true, initialCountry: "auto", geoIpLookup: function (success, failure) { $.get("https://ipinfo.io", function () { }, "jsonp").always(function (resp) { var countryCode = (resp && resp.country) ? resp.country : "au"; success(countryCode); }); }, utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.21/js/utils.min.js", }); }); jQuery(document).ready(function () { function setCookie2(cname, cvalue, exdays) { const d = new Date(); d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000); let expires = 'expires=' + d.toUTCString(); document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; } var consultationFormError = false; var scheduleCallURL = 'https://talkto.jhavtech.com.au/meetings/bookwithus/now'; function validateEmail(email) { var emailReg = /[^@\s]+@[^@\s]+\.[^@\s]+/; return emailReg.test(email); } // Description validation. var descriptionInputBlurred = false; $('.consultation-form-3 textarea[name="description"]').blur(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; descriptionInputBlurred = true; if ($('.consultation-form-3 textarea[name="description"]').val().length < 1) { $('.nda-form-description-error-text').show().text('Please fill in this field'); consultationFormError = true; } else if ($('.consultation-form-3 textarea[name="description"]').val().length > 5000) { $('.nda-form-description-error-text').show().text('Description exceeds the 5000 character limit'); consultationFormError = true; } else { $('.nda-form-description-error-text').hide().text(''); } }); $('.consultation-form-3 textarea[name="description"]').keyup(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; if (!descriptionInputBlurred) { return false; } if ($('.consultation-form-3 textarea[name="description"]').val().length < 1) { $('.nda-form-description-error-text').show().text('Please fill in this field'); consultationFormError = true; } else if ($('.consultation-form-3 textarea[name="description"]').val().length > 5000) { $('.nda-form-description-error-text').show().text('Description exceeds the 5000 character limit'); consultationFormError = true; } else { $('.nda-form-description-error-text').hide().text(''); } }); // Phone number validation var phoneInputBlurred = false; $('.consultation-form-3 input[name="mobnum"]').blur(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; phoneInputBlurred = true; if ($('.consultation-form-3 input[name="mobnum"]').val().length < 1) { $('.nda-form-phone-error-text').show().text('Please fill in this field'); consultationFormError = true; } else if ($('.consultation-form-3 input[name="mobnum"]').val().length > 100) { $('.nda-form-phone-error-text').show().text('Phone number exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-phone-error-text').hide().text(''); } }); $('.consultation-form-3 input[name="mobnum"]').keyup(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; if (!phoneInputBlurred) { return false; } if ($('.consultation-form-3 input[name="mobnum"]').val().length < 1) { $('.nda-form-phone-error-text').show().text('Please fill in this field'); consultationFormError = true; } else if ($('.consultation-form-3 input[name="mobnum"]').val().length > 100) { $('.nda-form-phone-error-text').show().text('Phone number exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-phone-error-text').hide().text(''); } }); // Email validation var emailInputBlurred = false; $('.consultation-form-3 input[name="email"]').blur(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; emailInputBlurred = true; var emailEntered = $('.consultation-form-3 input[name="email"]').val(); if (emailEntered.length < 1) { $('.nda-form-email-error-text').show().text('Please fill in this field'); consultationFormError = true; } else { if (!validateEmail(emailEntered)) { $('.nda-form-email-error-text').show().text('Invalid email'); } else if (emailEntered.length > 100) { $('.nda-form-email-error-text').show().text('Email exceeds the 100 character limit'); } else { $('.nda-form-email-error-text').hide().text(''); } } }); $('.consultation-form-3 input[name="email"]').keyup(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; if (!emailInputBlurred) { return false; } var emailEntered = $('.consultation-form-3 input[name="email"]').val(); if (emailEntered.length < 1) { $('.nda-form-email-error-text').show().text('Please fill in this field'); consultationFormError = true; } else { if (!validateEmail(emailEntered)) { $('.nda-form-email-error-text').show().text('Invalid email'); } else if (emailEntered.length > 100) { $('.nda-form-email-error-text').show().text('Email exceeds the 100 character limit'); } else { $('.nda-form-email-error-text').hide().text(''); } } }); // First name validation (required) var firstNameInputBlurred = false; $('.consultation-form-3 input[name="first-name"]').blur(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; firstNameInputBlurred = true; if ($('.consultation-form-3 input[name="first-name"]').val().length < 1) { $('.nda-form-first-name-error-text').show().text('Please fill in this field'); consultationFormError = true; } else if ($('.consultation-form-3 input[name="first-name"]').val().length > 100) { $('.nda-form-first-name-error-text').show().text('First name exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-first-name-error-text').hide().text(''); } }); $('.consultation-form-3 input[name="first-name"]').keyup(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; if (!firstNameInputBlurred) { return false; } if ($('.consultation-form-3 input[name="first-name"]').val().length < 1) { $('.nda-form-first-name-error-text').show().text('Please fill in this field'); consultationFormError = true; } else if ($('.consultation-form-3 input[name="first-name"]').val().length > 100) { $('.nda-form-first-name-error-text').show().text('First name exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-first-name-error-text').hide().text(''); } }); // Last name validation (optional) var lastNameInputBlurred = false; $('.consultation-form-3 input[name="last-name"]').blur(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; lastNameInputBlurred = true; if ($('.consultation-form-3 input[name="last-name"]').val().length > 100) { $('.nda-form-last-name-error-text').show().text('Last name exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-last-name-error-text').hide().text(''); } }); $('.consultation-form-3 input[name="last-name"]').keyup(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; if (!lastNameInputBlurred) { return false; } if ($('.consultation-form-3 input[name="last-name"]').val().length > 100) { $('.nda-form-last-name-error-text').show().text('Last name exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-last-name-error-text').hide().text(''); } }); // Add this near the other validation code (with last name and job role) // Company name validation (optional) var companyNameInputBlurred = false; $('.consultation-form-3 input[name="company-name"]').blur(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; companyNameInputBlurred = true; if ($('.consultation-form-3 input[name="company-name"]').val().length > 100) { $('.nda-form-company-name-error-text').show().text('Company name exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-company-name-error-text').hide().text(''); } }); $('.consultation-form-3 input[name="company-name"]').keyup(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; if (!companyNameInputBlurred) { return false; } if ($('.consultation-form-3 input[name="company-name"]').val().length > 100) { $('.nda-form-company-name-error-text').show().text('Company name exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-company-name-error-text').hide().text(''); } }); // Job role validation (optional) var jobRoleInputBlurred = false; $('.consultation-form-3 input[name="job-role"]').blur(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; jobRoleInputBlurred = true; if ($('.consultation-form-3 input[name="job-role"]').val().length > 100) { $('.nda-form-job-role-error-text').show().text('Job role exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-job-role-error-text').hide().text(''); } }); $('.consultation-form-3 input[name="job-role"]').keyup(function () { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; if (!jobRoleInputBlurred) { return false; } if ($('.consultation-form-3 input[name="job-role"]').val().length > 100) { $('.nda-form-job-role-error-text').show().text('Job role exceeds the 100 character limit'); consultationFormError = true; } else { $('.nda-form-job-role-error-text').hide().text(''); } }); $('#wf-form-Consultation-Form-3').submit(function (e) { if ($('.consultation-form-3').attr("data-preventdefaulthandling") && $('.consultation-form-3').attr("data-preventdefaulthandling") === "true") return; e.preventDefault(); consultationFormError = false; var sourceURL = window.location.href; var sourceMedium = $("#wf-form-Consultation-Form-3").attr('data-source_medium'); if (!sourceMedium || sourceMedium.length < 1) { sourceMedium = ''; } // Hidden phone input for HubSpot tracking. $('#wf-form-Consultation-Form-3').find('input[name="phone"]').val($('#wf-form-Consultation-Form-3').find('input[name="mobnum-full"]').val()).attr('value', $('#wf-form-Consultation-Form-3').find('input[name="mobnum-full"]').val()); // Google reCAPTHCA var reCAPTCHAToken = ''; grecaptcha.ready(function () { grecaptcha.execute('6LdCbcMZAAAAAKXkD4ax_gncd7aWhEllrc8LdvSZ', { action: 'contactform' }).then(function (token) { reCAPTCHAToken = token; $('.consultation-form-error-text').hide(); var consultationFormId = '6694'; if ($('#wf-form-Consultation-Form-3').attr('data-formid') && $('#wf-form-Consultation-Form-3').attr('data-formid').length > 0) { consultationFormId = $('#wf-form-Consultation-Form-3').attr('data-formid'); } var consultationFormAPIEndpoint = 'https://www.jhavtech.com.au/wp-json/contact-form-7/v1/contact-forms/'+consultationFormId+'/feedback'; // Description validation if ($('.consultation-form-3 textarea[name="description"]').val().length < 1) { $('.nda-form-description-error-text').text('Please fill in this field').show(); $('.consultation-form-block').scrollTop(0); consultationFormError = true; } if ($('.consultation-form-3 textarea[name="description"]').val().length > 5000) { $('.nda-form-description-error-text').text('Description exceeds the 5000 character limit').show(); $('.consultation-form-block').scrollTop(0); consultationFormError = true; } // Phone number validation if ($('.consultation-form-3 input[name="mobnum"]').val().length < 1) { $('.nda-form-phone-error-text').show().text('Please fill in this field'); consultationFormError = true; } else if ($('.consultation-form-3 input[name="mobnum"]').val().length > 100) { $('.nda-form-phone-error-text').show().text('Phone number exceeds the 100 character limit'); consultationFormError = true; } // Email validation var emailEntered = $('.consultation-form-3 input[name="email"]').val(); if (emailEntered.length < 1) { $('.nda-form-email-error-text').show().text('Please fill in this field'); consultationFormError = true; } else { if (!validateEmail(emailEntered)) { $('.nda-form-email-error-text').show().text('Invalid email'); consultationFormError = true; } else if (emailEntered.length > 100) { $('.nda-form-email-error-text').show().text('Email exceeds the 100 character limit'); consultationFormError = true; } } // First name validation if ($('.consultation-form-3 input[name="first-name"]').val().length < 1) { $('.nda-form-first-name-error-text').text('Please fill in this field').show(); consultationFormError = true; } else if ($('.consultation-form-3 input[name="first-name"]').val().length > 100) { $('.nda-form-first-name-error-text').text('First name exceeds the 100 character limit').show(); consultationFormError = true; } // Last name validation (only check max length) if ($('.consultation-form-3 input[name="last-name"]').val().length > 100) { $('.nda-form-last-name-error-text').text('Last name exceeds the 100 character limit').show(); consultationFormError = true; } // Company name validation (only check max length) if ($('.consultation-form-3 input[name="company-name"]').val().length > 100) { $('.nda-form-company-name-error-text').text('Company name exceeds the 100 character limit').show(); consultationFormError = true; } // Job role validation (only check max length) if ($('.consultation-form-3 input[name="job-role"]').val().length > 100) { $('.nda-form-job-role-error-text').text('Job role exceeds the 100 character limit').show(); consultationFormError = true; } if (consultationFormError) { return false; } var consultationFormData = { '_wpcf7_recaptcha_response': reCAPTCHAToken, '_wpcf7_unit_tag': 'consultation-form', 'your-description': $('.consultation-form-3 textarea[name="description"]').val(), 'your-sms': $('.consultation-form-3 input[name="connect-mobnum-full"]').val(), 'your-email': $('.consultation-form-3 input[name="email"]').val(), 'your-firstname': $('.consultation-form-3 input[name="first-name"]').val(), 'your-lastname': $('.consultation-form-3 input[name="last-name"]').val(), 'your-companyname': $('.consultation-form-3 input[name="company-name"]').val(), 'your-jobrole': $('.consultation-form-3 input[name="job-role"]').val(), 'your-source-url': sourceURL, 'your-source-medium': sourceMedium }; var formData = new FormData(); for (var key in consultationFormData) { formData.append(key, consultationFormData[key]); } // Scroll to top of the form. $('.consultation-form-block').scrollTop(0); // Body overflow fix $('body').css('overflow-y', 'hidden'); // Show Skeleton Loader $('.nda-form-popup').css({ display: 'none', opacity: '0' }); $('.nda-form-submitted-popup-skeleton').css({ display: 'flex' }); $.ajax({ url: consultationFormAPIEndpoint, type: 'POST', data: formData, processData: false, contentType: false, success: function (resp) { var response = resp; if (response.status === 'mail_sent') { $('.nda-form-submitted-popup-skeleton').css({ display: 'none' }); $('.nda-form-submitted-popup').css({ display: 'flex', opacity: '1' }); $('.consultation-form-error-text').hide(); // Set Cookie setCookie2('consultationFormSubmitted', 'true', 30); // For new design $('.consultation-form-submitted-popup-v2').css({ display: 'flex', opacity: '1' }); var scheduleCallQueryString = '?firstName=' + $('.consultation-form-3 input[name="first-name"]').val() + '&lastName=' + $('.consultation-form-3 input[name="last-name"]').val() + '&email=' + $('.consultation-form-3 input[name="email"]').val() + '&phone=' + $('.consultation-form-3 input[name="mobnum-full"]').val(); var finalScheduleCallURL = scheduleCallURL + scheduleCallQueryString; $('.consultation-form-submitted-v2-schedule-box-button').attr('href', finalScheduleCallURL); document.getElementById('wf-form-Consultation-Form-3').reset(); if ($('#wf-form-Consultation-Form-3').attr('data-skipserviceselect') === 'true') { $('input[name="service"][value="app-development"]').prop('checked', true); } } else if (response.status === 'validation_failed' && response.invalid_fields && response.invalid_fields.length > 0 && response.invalid_fields[0].field == 'your-email') { $('.nda-form-email-error-text').show().text('Please use a different email'); $('.nda-form-popup').css({ display: 'flex', opacity: '1' }); $('.nda-form-submitted-popup-skeleton').css({ display: 'none' }); } else { $('body').css('overflow-y', 'auto'); $('.nda-form-popup').css({ display: 'flex', opacity: '1' }); $('.nda-form-submitted-popup-skeleton').css({ display: 'none' }); $('.consultation-form-error-text').hide(); alert('Error: ' + response.status + '\nMessage: ' + response.message); } }, error: function (jqXHR, textStatus, errorThrown) { $('body').css('overflow-y', 'auto'); $('.nda-form-popup').css({ display: 'flex', opacity: '1' }); $('.nda-form-submitted-popup-skeleton').css({ display: 'none' }); $('.consultation-form-error-text').hide(); alert('Something went wrong. Please try again later.'); console.log(jqXHR); }, }); }); }); }); }); document.addEventListener('DOMContentLoaded', function () { const cards = document.querySelectorAll('.service-technology-card'); cards.forEach(card => { const button = card.querySelector('.service-technology-card-button'); const tooltip = card.querySelector('.service-technology-tooltip'); const closeButton = card.querySelector('.service-technology-card-tooltip-close'); // Initialize styles tooltip.style.opacity = 0; tooltip.style.transition = 'opacity 0.3s ease'; tooltip.style.display = 'none'; let isVisible = false; button.addEventListener('click', function () { // Hide all other tooltips document.querySelectorAll('.service-technology-tooltip').forEach(t => { if (t !== tooltip) { t.style.opacity = 0; setTimeout(() => { t.style.display = 'none'; }, 300); t.dataset.visible = 'false'; } }); // Toggle current tooltip if (!isVisible) { tooltip.style.display = 'block'; setTimeout(() => { tooltip.style.opacity = 1; }, 10); // slight delay for transition to take effect } else { tooltip.style.opacity = 0; setTimeout(() => { tooltip.style.display = 'none'; }, 300); } isVisible = !isVisible; }); closeButton.addEventListener('click', function () { tooltip.style.opacity = 0; setTimeout(() => { tooltip.style.display = 'none'; }, 300); isVisible = false; }); }); }); let scrollPosition = 0; let isScrollLocked = false; function lockScroll() { if (isScrollLocked) return; scrollPosition = window.pageYOffset || document.documentElement.scrollTop; document.body.style.overflow = 'hidden'; document.body.style.position = 'fixed'; document.body.style.top = `-${scrollPosition}px`; document.body.style.width = '100%'; document.body.getBoundingClientRect(); // force reflow isScrollLocked = true; } function unlockScroll() { document.body.style.overflow = ''; document.body.style.position = ''; document.body.style.top = ''; document.body.style.width = ''; window.scrollTo({ top: scrollPosition, behavior: 'auto' }); isScrollLocked = false; } function unlockScrollIfAllHidden() { const popup = document.querySelector('.nda-form-popup'); const submittedPopup = document.querySelector('.nda-form-popup-submitted'); const isPopupVisible = popup && window.getComputedStyle(popup).display !== 'none'; const isSubmittedVisible = submittedPopup && window.getComputedStyle(submittedPopup).display !== 'none'; if (!isPopupVisible && !isSubmittedVisible) { unlockScroll(); // Only unlock once all are hidden } } document.addEventListener('DOMContentLoaded', function () { const popup = document.querySelector('.nda-form-popup'); const closeButton = document.querySelector('.nda-form-close-icon'); const submittedPopup = document.querySelector('.nda-form-submitted-popup'); const submittedCloseBtn = document.querySelector('.nda-form-submitted-button'); if (popup) { const observer = new MutationObserver(() => { const isVisible = window.getComputedStyle(popup).display !== 'none'; isVisible ? lockScroll() : unlockScrollIfAllHidden(); }); observer.observe(popup, { attributes: true, attributeFilter: ['style'] }); if (closeButton) { closeButton.addEventListener('click', () => { popup.style.display = 'none'; }); } } if (submittedPopup) { const submittedObserver = new MutationObserver(() => { const isSubmittedVisible = window.getComputedStyle(submittedPopup).display !== 'none'; isSubmittedVisible ? lockScroll() : unlockScrollIfAllHidden(); }); submittedObserver.observe(submittedPopup, { attributes: true, attributeFilter: ['style'] }); if (submittedCloseBtn) { submittedCloseBtn.addEventListener('click', () => { submittedPopup.style.display = 'none'; }); } } });