OK here is my code:
<script type="text/javascript">
var prev_si = '';
function UnselectActivePollingUser()
{
var user = document.userAdd.addUser[document.userAdd.addUser.selectedIndex].value;
if (user =='ActivePollingCard')
{
alert("This user currently has an Active Polling Card. The user cannot be moved into another group until the user is done selecting or skipped.");
document.forms['userAdd'].elements['addUser'].selectedIndex = prev_si;
}
}
</script>
<select name="addUser" multiple="true" size="5" onclick='prev_si = this.selectedIndex;' onchange="javascript:UnselectActivePollingUser();">
I have a multiselect with an onchange event that checks if the selected index is = 'ActivePollingCard'. It pops up an alert and tells the user they cannot select this one, and it sets them back to some other pre-selected index.
My problem is that I can select this value with other ones, and then it does not give me the alert because I have selected more than one value in the select box.
Is there a way to check if this value exists amongst multiple selects, and if it does fire the alert, and just re-set or set them back to another index. I don't care we reset the user to as long as they are not allowed to select that value at all, either by single selection or multiple selection. This needs to remain a multiple select.
PLEASE HELP!!
<script type="text/javascript">
var prev_si = '';
function UnselectActivePollingUser()
{
var user = document.userAdd.addUser[document.userAdd.addUser.selectedIndex].value;
if (user =='ActivePollingCard')
{
alert("This user currently has an Active Polling Card. The user cannot be moved into another group until the user is done selecting or skipped.");
document.forms['userAdd'].elements['addUser'].selectedIndex = prev_si;
}
}
</script>
<select name="addUser" multiple="true" size="5" onclick='prev_si = this.selectedIndex;' onchange="javascript:UnselectActivePollingUser();">
I have a multiselect with an onchange event that checks if the selected index is = 'ActivePollingCard'. It pops up an alert and tells the user they cannot select this one, and it sets them back to some other pre-selected index.
My problem is that I can select this value with other ones, and then it does not give me the alert because I have selected more than one value in the select box.
Is there a way to check if this value exists amongst multiple selects, and if it does fire the alert, and just re-set or set them back to another index. I don't care we reset the user to as long as they are not allowed to select that value at all, either by single selection or multiple selection. This needs to remain a multiple select.
PLEASE HELP!!