I have a web page below with some jquery to catch the submit of a form ...now in that code before i submit the form I want to check the select box combos c#p# and make sure there aren't duplicates.
ie
$(
"#C0"
).val() + "-" +
$(
"#P0"
).val() is unique
so
$(
"#C3"
).val() + "-" +
$(
"#P3"
).val() doesnt have the same value
I was thinking I could itterate through the table and concatenate
the strings
47-2694;64-2697...etc and then just check each value for a match as I go and if so alert the user and not submit the page until they have changed the selections to be unique
<head>
<script>
$(document).ready(function()
{
$("#target").click(function()
{
$("form[name='EmpSel']").submit(function()
{
alert('Form is submitting');
return true;
});
$("form[name='EmpSel']").submit(); //invoke form submission
});
});
</script>
</head>
<form name="EmpSel" method="GET" action="ViewWeekDetail.asp">
<h3>Entries:</h3>
<table border="1" width="100%">
<tr>
<td width="25%">
<select name="C0" OnChange="ShowActivities('EmpSel', 'C0', 'P0');" size="1">
<option value="">
<option selected value="64">Admin
<option value="47">ARIA_MO
<option value="48">ARIA_RO
</select>
</td>
<td width="25%">
<select name="P0" OnChange="" size="1">
<option value="">
<option selected value="2693">End User Support
<option value="2694">End User Training
<option value="2695">Information Request
<option value="2696">Network
<option value="2697">Other
</select>
</tr>
<tr>
<td width="25%">
<select name="C1" OnChange="ShowActivities('EmpSel', 'C1', 'P1');" size="1">
<option value="">
<option selected value="64">Admin
<option value="47">ARIA_MO
<option value="48">ARIA_RO
</select>
</td>
<td width="25%">
<select name="P1" OnChange="" size="1">
<option value="">
<option selected value="2693">End User Support
<option value="2694">End User Training
<option value="2695">Information Request
<option value="2696">Network
<option value="2697">Other
</select>
</td>
</tr>
<tr>
<td width="25%">
<select name="C2" OnChange="ShowActivities('EmpSel', 'C2', 'P2');" size="1">
<option value="">
<option selected value="64">Admin
<option value="47">ARIA_MO
<option value="48">ARIA_RO
</select>
</td>
<td width="25%">
<select name="P2" OnChange="" size="1">
<option value="">
<option selected value="2693">End User Support
<option value="2694">End User Training
<option value="2695">Information Request
<option value="2696">Network
<option value="2697">Other
</select>
</td>
</tr>
<tr>
<td width="25%">
<select name="C3" OnChange="ShowActivities('EmpSel', 'C3', 'P3');" size="1">
<option value="">
<option selected value="64">Admin
<option value="47">ARIA_MO
<option value="48">ARIA_RO
</select>
</td>
</tr>
</Form>