|
-
Jun 29th, 2009, 08:52 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Javascript get selected value
hi, how to create a validation if a choice has been made by the user? thank you for any ideas..
Code:
<body>
<form name="form1">
<select name="menu1">
<option>Select Item
<option>test1
<option>test2
<option>test3
</select>
</form>
<input type="submit" name="send" value="Send Details"></p>
</body>
The taller the bamboo grows the lower it bends... 
-
Jun 29th, 2009, 09:48 AM
#2
Re: Javascript get selected value
Your submit button needs to be inside your form.
Code:
<body>
<form name="form1">
<select name="menu1">
<option value="">Select Item
<option>test1
<option>test2
<option>test3
</select>
<input type="submit" name="send" value="Send Details">
</form>
</body>
<script type="text/Javascript">
<!--
document.form1.onsubmit = function(){
if(this.menu1.value == ""){
alert("it's blank.");
return false;
}
return true;
}
//-->
</script>
-
Jun 30th, 2009, 11:04 PM
#3
Thread Starter
Addicted Member
Re: Javascript get selected value
thanks SambaNeko
The taller the bamboo grows the lower it bends... 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|