bebig
11-10-2004, 07:52 PM
I have 5 drop down menues.
select name are auditorium1,auditorium2,auditorium3
auditorium4 auditorium5
I want to check the validation.
if I select the same number from 5 drop down menues, I will say " you have already selected this number"
And after I click "alert" sign, then the current page sends to the post page.
I do not want to send the current page to post page until there is no error.
Would you please give any idea??
Thank you in advance
---------this is a code---------------------
<html>
<body>
<form name=i3submitData action=i3getcopy.tcl method=post>
<center>
<table border="2" style="border-collapse: collapse; font-family:Verdana; font-size:11px" width="601" id="table1">
<tr>
<td width="93">Place</td>
</tr>
<tr>
<td width="30">House1</td>
<select name=auditorium1 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<select name=auditorium2 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<select name=auditorium3 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<select name=auditorium4 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<select name=auditorium5 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
<td width="200">
</tr>
</center>
</table>
<p><center><input type="submit" value="Submit" name="B3" style="font-family: Verdana; font-size: 11px" onClick="validateForm()">
<script language="JavaScript">
function validateForm()
{
for (var h=1; h < 7; h++) {
var s = document.i3submitData.auditoriumh;
if (s.options[s.selectedIndex].text=="---")
{alert ("please select house h");}
else {alert (s.options[s.selectedIndex].text);}
}
</script>
</form>
</body>
</html>
select name are auditorium1,auditorium2,auditorium3
auditorium4 auditorium5
I want to check the validation.
if I select the same number from 5 drop down menues, I will say " you have already selected this number"
And after I click "alert" sign, then the current page sends to the post page.
I do not want to send the current page to post page until there is no error.
Would you please give any idea??
Thank you in advance
---------this is a code---------------------
<html>
<body>
<form name=i3submitData action=i3getcopy.tcl method=post>
<center>
<table border="2" style="border-collapse: collapse; font-family:Verdana; font-size:11px" width="601" id="table1">
<tr>
<td width="93">Place</td>
</tr>
<tr>
<td width="30">House1</td>
<select name=auditorium1 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<select name=auditorium2 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<select name=auditorium3 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<select name=auditorium4 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<select name=auditorium5 style="font-family: Verdana; font-size: 11px">
<option>---</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
<td width="200">
</tr>
</center>
</table>
<p><center><input type="submit" value="Submit" name="B3" style="font-family: Verdana; font-size: 11px" onClick="validateForm()">
<script language="JavaScript">
function validateForm()
{
for (var h=1; h < 7; h++) {
var s = document.i3submitData.auditoriumh;
if (s.options[s.selectedIndex].text=="---")
{alert ("please select house h");}
else {alert (s.options[s.selectedIndex].text);}
}
</script>
</form>
</body>
</html>