Dear All,
After some tests I came up with a solution I needed. I will leave her with you.
The part that returns the values that were selected in the checkboxes, I kept.
function getCheckedValues()
{
return Array.from(document.querySelectorAll('input[type="checkbox"]'))
.filter((checkbox) => checkbox.checked)
.map((checkbox) => checkbox.value);
}
What I would have to do: It was to call another PHP page through Javascript.
So I developed:
function sendToPhysician() {
if (getCheckedValues() == "") {
alert('Please, select at least one row');
}
else {
window.location.assign("./../Tests/controller/sendToPhysicianSampleID.php?idList=" + getCheckedValues());
}
}
The alert I created at the last minute, considering that when pressing the button without selecting any of the options, some people could get lost, not knowing if the data was sent or not.