"Jesper Stocholm" <spam@stocholm.dk> wrote in message
news:9513te$dtj$1@eising.k-net.dk...
> På
http://stocholm.dk/vbscript/ har jeg lavet en lille test, der skal
checke
> en form for indhold inden den submittes.
>
koden er:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script type=text/vbscript>
function tjek_form(editfolder)
'Input field 1 - a dropdown-menu
if editfolder.dropdownbox.selectedIndex = 0 then
alert("Warning"+VbCrLf+VbCrLf+"You must select a value in the
dropdown-box")
editfolder.dropdownbox.focus
window.event.returnValue = false
exit function
end if
'Input field 2 - a text-field
if trim(editfolder.textfield.value) = "" then
alert("Warning:" + VbCrLf + "You must enter a calue in the text
field")
editfolder.textfield.focus
window.event.returnValue = false
exit function
end if
end function
</script>
</HEAD>
<BODY>
<form action="validated.asp" method="GET" onSubmit="return tjek_form(me)">
<select name="dropdownbox">
<option value="">! - Please select - !</option>
<option value=1">Choice 1</option>
</select>
<br>
<input type="text" name="textfield">
<br>
<input type="submit">
</form>
</BODY>
</HTML>