I've got a little problem hopefully someone will know something about.
In my php code I have a table which shows a schedule of dates/times, with drop down menus to assign people to work these events.
In the following javascript code, it looks to the row and if the person has already been assigned to the event, it displays a pop up message that the person has already been assigned to that event.
However....I would like for the script to look through the ENTIRE table (rather than just the same row) and where the date/time is the same as the date/time where they are already assigned, it will display this message.
The reason for this is because there can be more than one event at the same date/time, but at different locations, and as such these would be displayed on different rows of the table.
<script language="JavaScript">
<!--
function checksel(id,name) {
var cnt = 0;
var fields = new Array('referee','ar1','ar2');
var val = document.forms.theform.elements["rowdata["+id+"]["+name+"]"].value
for (i=0;i<fields.length;i++) {
var fval = document.forms.theform.elements["rowdata["+id+"]["+fields[i]+"]"].value
if (fields[i] != name && fval == val && val!=0)
cnt++;
}
if (cnt>0) {
alert("STOP! You've already assigned this referee to another game at this time!");
document.forms.theform.elements["rowdata["+id+"]["+name+"]"].selectedIndex=0;
}
}
//-->
</script>