Im having problems with getting the page to stop progressing to the asp one when the user enters the text outwith the limits i.e. no data entered. Could anyone give any guidance?

Cheers

<html>
<head>
<title></title>

<SCRIPT LANGUAGE="VBScript">
dim validation


Function MyForm_OnSubmit
validation = False


	MyForm_OnSubmit = False
	If (Len(Document.MyForm.txtSurName.Value) > 12) Then
		MsgBox "You have entered more than 12 characters"
		validation = False
	End If
	If ((Document.MyForm.txtSurName.Value) = "") Then
		MsgBox "You have forgotten to fill in the input box"
		validation = False
	End If
	If (Len(Document.MyForm.txtSurName.Value) < 13) Then
		validation = True
	End If
	If (validation = True) Then
		MyForm_OnSubmit = True
	Else
		MyForm_OnSubmit = False
	End If

End Function


</SCRIPT>
</head>
<body bgcolor = "lmonchiffon">
	<form name = "MyForm" action = "Validate.asp" method = "post" OnSubmit = "return validate(MyForm_OnSubmit)">
		<p>Enter Name</p>
		<input type = "text" name = "txtSurName" value = "">
		<input type = "submit" value = "Process">
		<input type = "reset" value = "reset">
	</form>
</body>
</html>

value = "" needed to be initialised and the onSubmit isnt needed and it works a treat.

#
validation = True also needed at the start instead of False.

This question has already been answered. Start a new discussion instead.