1function UpdateConatctDetails() { 2 let errorControlFirstName = "#divErrFirstName"; 3 let errorControlEmailAddr = "#divErrEmailaddress"; 4 let errorControlPhoneNo = "#divErrMobileNo"; 5 let errorControlAddress = "#divErrAddress"; 6 let txtFirstName = "#txtFirstName"; 7 let txtEmail = "#txtEmail"; 8 let txtPhoneNumber = "#txtPhoneNumber"; 9 let txtAddress = "#txtAddress"; 10 11 let isValid = true; 12 let phoneInput = document.querySelector(txtPhoneNumber); 13 14 // Use the existing intl-tel-input instance 15 let iti = phoneInstances[phoneInput.id]; 16 17 if (!iti) { 18 console.error("Phone input is not initialized properly."); 19 return; 20 } 21 22 // Get the selected country code 23 let countryCode = iti.getSelectedCountryData().dialCode; 24 25 $(errorControlFirstName).empty(); 26 $(errorControlEmailAddr).empty(); 27 $(errorControlPhoneNo).empty(); 28 $(errorControlAddress).empty(); 29 30 31 let inputRequest = { 32 Name: $(txtFirstName).val(), 33 Email: $(txtEmail).val(), 34 PhoneNumber: $(txtPhoneNumber).val(), 35 Message: $(txtAddress).val(), 36 CountryCode: countryCode 37 38 39 }; 40 41 if (inputRequest.Name.length === 0) { 42 $(errorControlFirstName).html("Please provide your name."); 43 $(txtFirstName).attr("required", ""); 44 45 isValid = false; 46 } 47 48 if (inputRequest.Email.length === 0) { 49 $(errorControlEmailAddr).html("Please provide a email address."); 50 $(txtEmail).attr("required", ""); 51 isValid = false; 52 } 53 if (inputRequest.PhoneNumber.length === 0 ) { 54 $(errorControlPhoneNo).html("Please provide mobile number."); 55 $(txtPhoneNumber).attr("required", ""); 56 isValid = false; 57 } 58 else { 59 const validationMessage = IsValidPhoneNumber(inputRequest.PhoneNumber); 60 61 if (validationMessage !== "") { 62 $(errorControlPhoneNo).html(validationMessage); 63 $(txtPhoneNumber).attr("required", ""); 64 isValid = false; 65 } else { 66 $(errorControlPhoneNo).html(""); // Clear any previous errors 67 } 68 } 69 if (inputRequest.Message.length === 0) { 70 $(errorControlAddress).html("Please provide message."); 71 $(txtAddress).attr("required", ""); 72 isValid = false; 73 } 74 if (isValid) { 75 callAjax("POST", "/updatecontactdetails", JSON.stringify(inputRequest), function (result) { 76 if (result.status === 2) { 77 displayUnauthorized(); 78 } 79 else if (result.status === 1) { 80 81 Swal.fire({ 82 title: "Success", 83 text: "Redirecting in 5 seconds.", 84 icon: 'success', 85 timer: 5000,
86 showConfirmButton: false 87 }).then(function () { 88 window.location.href = '/contact-us'; 89 }); 90 } 91 else if (result.status === 0) { 92 Swal.fire('Error', result.message, 'error'); 93 } 94 }); 95 } 96}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.