edit event listener to handle only one link group name submission

This commit is contained in:
Ryan Mwangi 2024-10-15 14:42:37 +03:00
parent a12b931acb
commit 00a7d97b21
1 changed files with 1 additions and 2 deletions

View File

@ -9,7 +9,6 @@ const form = document.getElementById('merge-form');
const newCalendar = document.createElement('div');
newCalendar.className = 'calendar';
newCalendar.innerHTML = `
<input type="text" id="link-group-name-${calendarIndex}" placeholder="Link Group Name">
<input type="text" id="prefix-${calendarIndex}" placeholder="Prefix">
<input type="checkbox" id="override-${calendarIndex}">
<label for="override-${calendarIndex}">Override</label>
@ -21,9 +20,9 @@ const form = document.getElementById('merge-form');
form.addEventListener('submit', (event) => {
event.preventDefault();
const linkGroupName = document.getElementById('link-group-name').value;
const calendarsData = [];
for (let i = 0; i < calendarIndex; i++) {
const linkGroupName = document.getElementById(`link-group-name-${i}`).value;
const prefix = document.getElementById(`prefix-${i}`).value;
const override = document.getElementById(`override-${i}`).checked;
const url = document.getElementById(`url-${i}`).value;