if (document.getElementById('actionId').value == 'recommendWithFin') {
var curRevSeqId = document.getElementById('currentReviewerSequence').value;
var allRevLen = allReviewersArray.length;
if (allRevLen <= curRevSeqId) {
alert('You must select the next approver before recommending the quote.');
valid = valid && false;
} else {
for (var i = curRevSeqId; i <= allRevLen; i++) {
if (allReviewersArray[i] == null || allReviewersArray[i] == '') {
alert('Please do not skip approver');
valid = valid && false;
}
}
}
}
I am trying to modify this code from the else part to generate an alert when a user skips any drop-down between previously selected drop-down.
To provide more context, consider a scenario where there are 10 drop-downs. The user selects a value in the first drop-down and skips drop-downs 2 to 5, instead selecting the 6th drop-down. In this case, an alert should be triggered, indicating that no drop-down should be skipped between previously selected drop-down.
However, it is important to note that the user is not required to select all 10 drop-down; it is their choice. Therefore, the alert should only appear when there is a drop-down skipped between already selected drop-down, and not when the user decides not to select every drop-down present.
Can you please modify the code to incorporate this functionality?
Tried many logics but the array is considering all the drop downs and alert message is triggered
I can't really help you modify your code as you didn't provide a working snippet to begin with, but this is a prof of concept on how to do what you want.
Basically you would want to: