hi i want validations for two dropdown lists in java
script.when user enter to second dropdown list by skipping
first dropdown list we should get alert box. please help me
very urgent
Answer Posted / sasi5586
<HTML><HEAD>
<TITLE>drop down validation</TITLE>
<script type="text/javascript">
function validateForm(){
if(document.ItemList.Item.selectedIndex==0)
{
alert("Please select item from first list.");
document.ItemList.Item.focus();
return false;
}
return true;
}
</SCRIPT>
</HEAD>
<BODY>
Please choose an item from the drop down menu:
<form name="ItemList" method="post" action="asp.html"
onsubmit="validateForm()">
<table width="100%" border="0">
<tr>
<td width="135">Choose a username: </td>
<td>
<select name="Item">
<option value selected> SELECT </option>
<option value>Apples</option>
<option value>Oranges</option>
</select>
<table width="100%" border="0">
<tr>
<td width="135">Choose a username: </td>
<td>
<select name="Item" onclick="validateForm()">
<option value selected> SELECT </option>
<option value>Apples</option>
<option value>Oranges</option>
</select>
<input type="submit" name="Submit" value="Submit">
</td></tr></table></form>
</BODY>
</HTML>
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What does the instanceof operator do?
a code in vb script, which creates a table of 5*2 in html this is a static table, one more same dynamic table, as we give input the table should get created.
What is Associative Array? How do we use it?
Explain higher-order functions in javascript?
What is closure?
What is the use of a map object in javascript?
how to validate the date(dd/mm/yyyy)using regular expression in javascript? It should also satisfy the leap year feb 29 problem. Please help me.
What is the use of a set object in javascript?
Explain what is pop()method in JavaScript?
how to get no of items from from weblist?
What is javascript and its advantages?
Does apple use javascript?
How to redirect a url using JavaScript?
What is the importance of javascript?
What is node ecosystem?