Currently, I am developing an airport application that aims to track the time it takes to travel between different airports. In this context, moving from one airport to another is referred to as a Sector, and the duration of time taken for this journey is known as Block Time.
In my form design, there are provisions for users to input details for up to 8 Sectors. However, I face a challenge with displaying the total number of only filled out sectors before hitting the submit button. This can be achieved by having the field labeled # of Sectors show the count of completed sectors by identifying how many fields marked with the 'Calctime' class are not empty. Notably, all fields designated as Block Time have the 'Calctime' class associated with them.
To provide further insight, you can view the form layout featuring 8 Sectors.
The function I have created to address this issue seems to be returning the total number of fields (8) instead of just the count of filled-up fields. The function script in question:
function sectors(){
var items = [...document.querySelectorAll('.calctime')]; //demo to count number of empty
document.getElementById('sector').value = items.length
}