I have an ASP page with a form in it. The form contains two fields. The second field is a list box that gets its data from a database. This list box is generated dynamically using VBscript. This is why I chose an ASP page for this form as opposed to a HTML page, I did not know how to fill the list box on an HTML page.
The first field is simply a text box. I want to validate that the user did not leave it blank and I want to make sure it is a number.
I tried creating a simple sub routine on this same ASP page that checked the value of this field and was called from the Form's onsubmit action. I could not get this to work.
How can I validate this field and display a message to the user? I am open to changing this to a HTML page if the list box can still be filled. Here is my page:
The values in the form are sent to another ASP page for processing.
The first field is simply a text box. I want to validate that the user did not leave it blank and I want to make sure it is a number.
I tried creating a simple sub routine on this same ASP page that checked the value of this field and was called from the Form's onsubmit action. I could not get this to work.
How can I validate this field and display a message to the user? I am open to changing this to a HTML page if the list box can still be filled. Here is my page:
Code:
<% @Language=VBScript%>
<HTML>
<HEAD>
<%
Dim objDB
Dim objRS
Dim sDBName
Dim msg
sDBName = "driver={Microsoft Access Driver (*.mdb)};dbq=C:\Inetpub\[URL unfurl="true"]wwwroot\VoregWeb.mdb"[/URL]
Set objDB = Server.CreateObject("ADODB.Connection")
objDB.Open sDBName
Set objRS = objDB.Execute("select Distinct [StreetName] from [tblStreets] order by [StreetName]")
%>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<FORM action="DetWard.asp" method=POST id=form1 name=form1>
Street Number:
<Input Type=text name="Number" size=8>
Street Name:
<%
Response.Write("<select name=""Address"">")
Do While Not objRS.EOF
Response.Write("<option value=" & Chr(34) & objRS("StreetName") & Chr(34) & ">" & objRS("StreetName"))
objRS.MoveNext
Loop
Response.Write("</select>")%>
<Input Type=submit name="Submit" Value="Submit Address">
</FORM>
<P> </P>
</BODY>
</HTML>
The values in the form are sent to another ASP page for processing.