Commit 0ac1a3fd by Owen Ryan Ang

XML Generation logic changes to accommodate radiolist changes.

parent 9550d9c8
......@@ -481,7 +481,10 @@ const inputChecklist = (key, validation) => {
checkbox.name = `checkboxChoices_${key}`;
checkbox.classList.add("checkboxOption");
checkbox.value = item;
if (index == 0) checkbox.setAttribute('id', `${key}`);
if (index == 0) {
checkbox.classList.add("checkboxFirst");
checkbox.setAttribute('id', `${key}`);
}
div.appendChild(checkbox);
var label = document.createTextNode(item);
......@@ -571,8 +574,10 @@ const inputRadiolist = (key, validation) => {
radio.name = `radioChoices_${key}`;
radio.classList.add("radioOption");
radio.value = item;
if (index == 0) radio.setAttribute('id', `${key}`);
if (index == 0) {
radio.classList.add('radioFirst');
radio.setAttribute('id', `${key}`);
}
var label = document.createTextNode(item);
radioDiv.appendChild(radio);
radioDiv.appendChild(label);
......
......@@ -33,8 +33,9 @@ export async function WriteForm(e,metrics,doctype,section) {
continue;
}
// If the first radio button was found
if (fid == 'Radio_List') {
const radioButtons = document.getElementsByName('radioChoices');
if (Nodes[i].classList.contains('radioFirst')) {
var key = fid;
const radioButtons = document.getElementsByName(`radioChoices_${key}`);
let selectedValue;
//check if the value is checked to find the selected value
radioButtons.forEach(radio => {
......@@ -50,8 +51,9 @@ export async function WriteForm(e,metrics,doctype,section) {
}
// If the first checkbox was found
if (fid == 'Checkbox_List') {
const checkboxButtons = document.getElementsByName('checkboxChoices');
if (Nodes[i].classList.contains('checkboxFirst')) {
var key = fid;
const checkboxButtons = document.getElementsByName(`checkboxChoices_${key}`);
let selectedValue = '';
let isFirstChecked = true; // Variable to track the first checked checkbox
//check each checkbox if it is checked to find the values.
......
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