1/* 2--- 3 4requires: [AbacusAD, MooTools, Class, Class.Extras, DomReady, Element, Element.Event] 5 6provides: [AbacusAD.OtherQuestion] 7 8... 9*/ 10 11document.addEventListener('DOMContentLoaded', function () { 12 // Get the radio inputs 13 14 const guestEmailInput = document.getElementById('CenterContent_C30_ctl00_tbEmailGuest'); 15 const guestFirstNameInput = document.getElementById('CenterContent_C30_ctl00_tbFirstName'); 16 const guestLastNameInput = document.getElementById('CenterContent_C30_ctl00_tbLastName'); 17 const noGuestEmailInput = document.getElementById('CenterContent_C30_ctl00_tbEmail'); // Change with actual ID 18 19 if (typeof errorUserExist === 'undefined') { 20 return; 21 } 22 23 if (errorUserExist) { 24 const radioInputs = document.querySelectorAll('.sign-option-guest .label-title > input[type="radio"]'); 25 const guestEmail = document.querySelector('input#CenterContent_C30_ctl00_tbEmailGuest'); 26 27 radioInputs.forEach(input => { 28 input.checked = false; // Uncheck all radio inputs 29 radioInputs.forEach(input => { 30 input.addEventListener('change', function () { 31 if (input.value === 'guestOption') { 32 noGuestEmailInput.value = ''; 33 } else if (input.value === 'noGuestOption') { 34 guestEmailInput.value = ''; 35 guestFirstNameInput.value = ''; 36 guestLastNameInput.value = ''; 37 } 38 }); 39 }); 40 }); 41 const loginToAccountInput = document.querySelector('.sign-option-guest input[value="rbHavePassword"]'); 42 const passwordField = document.querySelector('.sign-option-guest .group.passwordField'); 43 if (loginToAccountInput) { 44 loginToAccountInput.checked = true; 45 passwordField.parentElement.classList.remove('disabled'); 46 passwordField.querySelector('input').removeAttribute("disabled"); 47 48 } 49 const loginToEmailInput = document.querySelector('.sign-option-guest .validate-email'); 50 console.log(loginToEmailInput.value); 51 if (loginToEmailInput.value.trim() === '') { 52 if (guestEmail.value !== '') { 53 loginToEmailInput.value = guestEmail.value; 54 guestEmail.value = ''; 55 guestFirstNameInput.value = ''; 56 guestLastNameInput.value = ''; 57 } else { 58 59 noGuestEmailInput.checked; 60 } 61 62 } 63 64 const noGuestOptionInput = document.querySelector('.sign-option-guest .label-title > input[value="noGuestOption"]'); 65 if (noGuestOptionInput) { 66 noGuestOptionInput.checked = true; // Check the desired radio input 67 68 } 69 70 } 71 72 73 74 75 76 77 const radioInputs = document.querySelectorAll('.sign-option-guest .label-title > input[type="radio"]'); 78 radioInputs.forEach(input => { 79 const label = document.querySelectorAll(".sign-option-guest .label-title"); 80 const displayField = document.querySelectorAll(".sign-option-guest .label-title .sign-option-choice"); 81 82 //check if the error is existing error 83 84 85 86 87 // Function to update the UI based on the selected radio input 88 function updateUI(input) { 89 label.forEach(label => { 90 label.classList.remove('selected'); 91 }); 92 displayField.forEach(choice => { 93 choice.classList.add('disabled'); 94 }); 95 96 const choice = input.nextElementSibling.querySelector('.sign-option-choice'); 97 98 if (choice) { 99 input.parentElement.classList.add('selected'); 100 choice.classList.remove('disabled'); 101 } 102 103 104 } 105 106 // Initialize the UI based on the preselected input 107 if (input.checked) { 108 updateUI(input); 109 } 110 111 input.addEventListener("change", function () { 112 // Handle radio input changes 113 updateUI(input); 114 if (input.value === 'guestOption') { 115 noGuestEmailInput.value = ''; 116 } else if (input.value === 'noGuestOption') { 117 guestEmailInput.value = ''; 118 guestFirstNameInput.value = ''; 119 guestLastNameInput.value = ''; 120 } 121 }); 122 123 }); 124 125});
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.