Commit 23600d0c by Owen Ryan Ang

"other" textbox removed after unchecking "other" radio button

parent 0ac1a3fd
......@@ -502,7 +502,7 @@ const inputChecklist = (key, validation) => {
dependentCheckbox.name = `checkboxChoices_${key}`;
dependentCheckbox.classList.add("checkboxOption");
dependentCheckbox.id = 'checkDP';
dependentCheckbox.value = ''; // Set the value here based on the input text
dependentCheckbox.value = 'other'; // Set the value here based on the input text
dependentDiv.appendChild(dependentCheckbox);
var dependentLabel = document.createTextNode('other');
......@@ -519,7 +519,7 @@ const inputChecklist = (key, validation) => {
dropdownContent.appendChild(inputTextBox);
// Add event listener to the "other" checkbox
dependentCheckbox.addEventListener('change', function () {
dropdownContent.addEventListener('change', function () {
if (dependentCheckbox.checked) {
inputTextBox.style.display = 'inline-block';
} else {
......@@ -592,7 +592,7 @@ const inputRadiolist = (key, validation) => {
dependentRadio.type = 'radio';
dependentRadio.name = `radioChoices_${key}`;
dependentRadio.classList.add("radioOption");
dependentRadio.value = '';
dependentRadio.value = 'other';
dependentDiv.appendChild(dependentRadio);
var dependentLabel = document.createTextNode('other');
......@@ -608,7 +608,7 @@ const inputRadiolist = (key, validation) => {
dropdownContent.appendChild(inputTextBox);
// Add event listener to the "other" radio button
dependentRadio.addEventListener('change', function () {
dropdownContent.addEventListener('change', function () {
if (dependentRadio.checked) {
inputTextBox.style.display = 'inline-block';
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment