Commit 23600d0c by Owen Ryan Ang

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

parent 0ac1a3fd
...@@ -502,7 +502,7 @@ const inputChecklist = (key, validation) => { ...@@ -502,7 +502,7 @@ const inputChecklist = (key, validation) => {
dependentCheckbox.name = `checkboxChoices_${key}`; dependentCheckbox.name = `checkboxChoices_${key}`;
dependentCheckbox.classList.add("checkboxOption"); dependentCheckbox.classList.add("checkboxOption");
dependentCheckbox.id = 'checkDP'; 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); dependentDiv.appendChild(dependentCheckbox);
var dependentLabel = document.createTextNode('other'); var dependentLabel = document.createTextNode('other');
...@@ -519,7 +519,7 @@ const inputChecklist = (key, validation) => { ...@@ -519,7 +519,7 @@ const inputChecklist = (key, validation) => {
dropdownContent.appendChild(inputTextBox); dropdownContent.appendChild(inputTextBox);
// Add event listener to the "other" checkbox // Add event listener to the "other" checkbox
dependentCheckbox.addEventListener('change', function () { dropdownContent.addEventListener('change', function () {
if (dependentCheckbox.checked) { if (dependentCheckbox.checked) {
inputTextBox.style.display = 'inline-block'; inputTextBox.style.display = 'inline-block';
} else { } else {
...@@ -592,7 +592,7 @@ const inputRadiolist = (key, validation) => { ...@@ -592,7 +592,7 @@ const inputRadiolist = (key, validation) => {
dependentRadio.type = 'radio'; dependentRadio.type = 'radio';
dependentRadio.name = `radioChoices_${key}`; dependentRadio.name = `radioChoices_${key}`;
dependentRadio.classList.add("radioOption"); dependentRadio.classList.add("radioOption");
dependentRadio.value = ''; dependentRadio.value = 'other';
dependentDiv.appendChild(dependentRadio); dependentDiv.appendChild(dependentRadio);
var dependentLabel = document.createTextNode('other'); var dependentLabel = document.createTextNode('other');
...@@ -608,7 +608,7 @@ const inputRadiolist = (key, validation) => { ...@@ -608,7 +608,7 @@ const inputRadiolist = (key, validation) => {
dropdownContent.appendChild(inputTextBox); dropdownContent.appendChild(inputTextBox);
// Add event listener to the "other" radio button // Add event listener to the "other" radio button
dependentRadio.addEventListener('change', function () { dropdownContent.addEventListener('change', function () {
if (dependentRadio.checked) { if (dependentRadio.checked) {
inputTextBox.style.display = 'inline-block'; inputTextBox.style.display = 'inline-block';
} else { } 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