473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with POST method in a test form

Hi I am trying to test a form as to its correct action. I am facing two
problems.
1) When I click the submit button, the registrationconfirmation.asp is not
activated. The registrationconfirmation.asp has only one line of code
'Thanks'.

Also, I have put a validation check for the first name. If I do not put any
name in the name field, and click the Submit button, the form does not warn
anything as it should. Looking for any help.
Thanks.

CODE:
<%@ Language=VBScript %>
<!-- #include file="adovbs.inc" -->

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Sailors Web Site</TITLE>
</HEAD>
<BODY>

<%
myDSN="DRIVER={Microsoft Access Driver (*.mdb)}; "
myDSN=myDSN & "DBQ=C:\____SAILORS\Sailors.mdb"

set CN=server.createobject("ADODB.Connection")
set RS=server.createobject("ADODB.Recordset")
CN.Open myDSN

RS.ActiveConnection=CN
SQL = "qAllClubs"

RS.Open SQL
%>
<DIV ALIGN=CENTER>
<BIG> <BIG><FONT COLOR=navy>Sailors Case Study</FONT></BIG></BIG>
</DIV>
<BR><BR>
<FORM ACTION="registrationconfirmation.asp" method=POST NAME = frmRegister>
<TABLE>
<TR>
<TD HEIGHT=50 COLSPAN=2><FONT COLOR=navy>Registration Screen</FONT></TD>
</TR>

<TR>
<TD>First Name</TD>
<TD><INPUT TYPE=text NAME=txtFirstName SIZE=15></TD>
<TD><WIDTH=100></TD>
<TD>&nbsp;</TD>
<TD>Last Name</TD>
<TD><INPUT TYPE=text NAME=txtLastName SIZE=15></TD>
</TR>

<TR>
<TD>State</TD>
<TD><INPUT TYPE=text NAME=txtState SIZE=2></TD>
<TD> <WIDTH=50></TD>
<TD> </TD>
<TD>Date of Birth</TD>
<TD><INPUT TYPE=text NAME=txtDateofBirth SIZE=8></TD>
</TR>

<TR>
<TD>Referee</TD>
<TD><INPUT TYPE=checkbox NAME=chkReferee VALUE=1></TD>
</TR>

<TR>
<TD>Professional Class</TD>
<TD COLSPAN=4>
<INPUT TYPE=radio NAME=optClass VALUE=1 checked>Professional
<INPUT TYPE=radio NAME=optClass VALUE=2>Ranked Amateur
<INPUT TYPE=radio NAME=optClass VALUE=3>Other
</TD>
</TR>

<TR>
<TD>Club Name</TD>
<TD COLSPAN=3>
<SELECT NAME="lstClubs" SIZE = "1">
<%
Do while Not RS.EOF
Response.Write "<OPTION VALUE='" &RS("clubname") & "'>"
Response.Write RS("clubname") & "</OPTION>"
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
%>
</SELECT></TD>
</TR>

<TR>
<TD>&nbsp;</TD>
</TR>

<TR>
<TD><INPUT TYPE=button NAME=btnSubmit VALUE=Submit></TD>
</TR>
</TABLE>
</FORM>

<%
Sub btnSubmit_OnClick()
'Verify all fields have been entered
If Len(frmRegister.txtFirstName.value) = 0 Then
Alert "You must enter a first name"
frmRegister.txtFirstName.focus
Exit Sub
End If
End Sub
%>

</BODY>
</HTML>
Jul 21 '05 #1
5 1772
You don't have a submit button and you are trying to handle a client-side
event with a server-side handler.

Bob Lehmann

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
Hi I am trying to test a form as to its correct action. I am facing two
problems.
1) When I click the submit button, the registrationconfirmation.asp is not
activated. The registrationconfirmation.asp has only one line of code
'Thanks'.

Also, I have put a validation check for the first name. If I do not put any name in the name field, and click the Submit button, the form does not warn anything as it should. Looking for any help.
Thanks.

CODE:
<%@ Language=VBScript %>
<!-- #include file="adovbs.inc" -->

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Sailors Web Site</TITLE>
</HEAD>
<BODY>

<%
myDSN="DRIVER={Microsoft Access Driver (*.mdb)}; "
myDSN=myDSN & "DBQ=C:\____SAILORS\Sailors.mdb"

set CN=server.createobject("ADODB.Connection")
set RS=server.createobject("ADODB.Recordset")
CN.Open myDSN

RS.ActiveConnection=CN
SQL = "qAllClubs"

RS.Open SQL
%>
<DIV ALIGN=CENTER>
<BIG> <BIG><FONT COLOR=navy>Sailors Case Study</FONT></BIG></BIG>
</DIV>
<BR><BR>
<FORM ACTION="registrationconfirmation.asp" method=POST NAME = frmRegister> <TABLE>
<TR>
<TD HEIGHT=50 COLSPAN=2><FONT COLOR=navy>Registration Screen</FONT></TD>
</TR>

<TR>
<TD>First Name</TD>
<TD><INPUT TYPE=text NAME=txtFirstName SIZE=15></TD>
<TD><WIDTH=100></TD>
<TD>&nbsp;</TD>
<TD>Last Name</TD>
<TD><INPUT TYPE=text NAME=txtLastName SIZE=15></TD>
</TR>

<TR>
<TD>State</TD>
<TD><INPUT TYPE=text NAME=txtState SIZE=2></TD>
<TD> <WIDTH=50></TD>
<TD> </TD>
<TD>Date of Birth</TD>
<TD><INPUT TYPE=text NAME=txtDateofBirth SIZE=8></TD>
</TR>

<TR>
<TD>Referee</TD>
<TD><INPUT TYPE=checkbox NAME=chkReferee VALUE=1></TD>
</TR>

<TR>
<TD>Professional Class</TD>
<TD COLSPAN=4>
<INPUT TYPE=radio NAME=optClass VALUE=1 checked>Professional
<INPUT TYPE=radio NAME=optClass VALUE=2>Ranked Amateur
<INPUT TYPE=radio NAME=optClass VALUE=3>Other
</TD>
</TR>

<TR>
<TD>Club Name</TD>
<TD COLSPAN=3>
<SELECT NAME="lstClubs" SIZE = "1">
<%
Do while Not RS.EOF
Response.Write "<OPTION VALUE='" &RS("clubname") & "'>"
Response.Write RS("clubname") & "</OPTION>"
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
%>
</SELECT></TD>
</TR>

<TR>
<TD>&nbsp;</TD>
</TR>

<TR>
<TD><INPUT TYPE=button NAME=btnSubmit VALUE=Submit></TD>
</TR>
</TABLE>
</FORM>

<%
Sub btnSubmit_OnClick()
'Verify all fields have been entered
If Len(frmRegister.txtFirstName.value) = 0 Then
Alert "You must enter a first name"
frmRegister.txtFirstName.focus
Exit Sub
End If
End Sub
%>

</BODY>
</HTML>

Jul 21 '05 #2
I thought the submit button is already in the code as:
<TD><INPUT TYPE=button NAME=btnSubmit VALUE=Submit></TD>
Can we not have client side validation in a asp page? Thanks
"Bob Lehmann" wrote:
You don't have a submit button and you are trying to handle a client-side
event with a server-side handler.

Bob Lehmann

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
Hi I am trying to test a form as to its correct action. I am facing two
problems.
1) When I click the submit button, the registrationconfirmation.asp is not
activated. The registrationconfirmation.asp has only one line of code
'Thanks'.

Also, I have put a validation check for the first name. If I do not put

any
name in the name field, and click the Submit button, the form does not

warn
anything as it should. Looking for any help.
Thanks.

CODE:
<%@ Language=VBScript %>
<!-- #include file="adovbs.inc" -->

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Sailors Web Site</TITLE>
</HEAD>
<BODY>

<%
myDSN="DRIVER={Microsoft Access Driver (*.mdb)}; "
myDSN=myDSN & "DBQ=C:\____SAILORS\Sailors.mdb"

set CN=server.createobject("ADODB.Connection")
set RS=server.createobject("ADODB.Recordset")
CN.Open myDSN

RS.ActiveConnection=CN
SQL = "qAllClubs"

RS.Open SQL
%>
<DIV ALIGN=CENTER>
<BIG> <BIG><FONT COLOR=navy>Sailors Case Study</FONT></BIG></BIG>
</DIV>
<BR><BR>
<FORM ACTION="registrationconfirmation.asp" method=POST NAME =

frmRegister>
<TABLE>
<TR>
<TD HEIGHT=50 COLSPAN=2><FONT COLOR=navy>Registration Screen</FONT></TD>
</TR>

<TR>
<TD>First Name</TD>
<TD><INPUT TYPE=text NAME=txtFirstName SIZE=15></TD>
<TD><WIDTH=100></TD>
<TD> </TD>
<TD>Last Name</TD>
<TD><INPUT TYPE=text NAME=txtLastName SIZE=15></TD>
</TR>

<TR>
<TD>State</TD>
<TD><INPUT TYPE=text NAME=txtState SIZE=2></TD>
<TD> <WIDTH=50></TD>
<TD> </TD>
<TD>Date of Birth</TD>
<TD><INPUT TYPE=text NAME=txtDateofBirth SIZE=8></TD>
</TR>

<TR>
<TD>Referee</TD>
<TD><INPUT TYPE=checkbox NAME=chkReferee VALUE=1></TD>
</TR>

<TR>
<TD>Professional Class</TD>
<TD COLSPAN=4>
<INPUT TYPE=radio NAME=optClass VALUE=1 checked>Professional
<INPUT TYPE=radio NAME=optClass VALUE=2>Ranked Amateur
<INPUT TYPE=radio NAME=optClass VALUE=3>Other
</TD>
</TR>

<TR>
<TD>Club Name</TD>
<TD COLSPAN=3>
<SELECT NAME="lstClubs" SIZE = "1">
<%
Do while Not RS.EOF
Response.Write "<OPTION VALUE='" &RS("clubname") & "'>"
Response.Write RS("clubname") & "</OPTION>"
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
%>
</SELECT></TD>
</TR>

<TR>
<TD> </TD>
</TR>

<TR>
<TD><INPUT TYPE=button NAME=btnSubmit VALUE=Submit></TD>
</TR>
</TABLE>
</FORM>

<%
Sub btnSubmit_OnClick()
'Verify all fields have been entered
If Len(frmRegister.txtFirstName.value) = 0 Then
Alert "You must enter a first name"
frmRegister.txtFirstName.focus
Exit Sub
End If
End Sub
%>

</BODY>
</HTML>


Jul 21 '05 #3
Jack wrote:
Can we not have client side validation in a asp page? Thanks

Of course you can. The client-side code is in the HTML that's sent to the
client by the ASP page. Which means that discussions of client-side code are
off-topic in an ASP group, since ALL ASP activity takes place on te server.
The .scripting newsgroups handle client-side code issues.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 21 '05 #4
Jack wrote:
I thought the submit button is already in the code as:
<TD><INPUT TYPE=button NAME=btnSubmit VALUE=Submit></TD>

No, that's a standard button. You need to use a submit button:

<INPUT TYPE=submit NAME=btnSubmit VALUE=Submit>

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 21 '05 #5
Thanks Bob, I appreciate your feedback.

"Bob Barrows [MVP]" wrote:
Jack wrote:
I thought the submit button is already in the code as:
<TD><INPUT TYPE=button NAME=btnSubmit VALUE=Submit></TD>

No, that's a standard button. You need to use a submit button:

<INPUT TYPE=submit NAME=btnSubmit VALUE=Submit>

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
4
by: Antonio Carpentieri | last post by:
Hi all, in my previous post I've wrong typed some tems.. this is the corrected post. in a aspx page I have a repeater like this: <asp:repeater id=repeaterResults runat="server"...
0
by: ian | last post by:
Hello, I have a small test.aspx page with an HtmlInputFile class instance and an imagebutton. When I run this on our proxy server and click the save imagebutton I get the "Page cannot be...
10
by: Danny | last post by:
I am working on a project where I will receive xml documents from clients machines as a byte array. They will use the web browser navigate method to post the data to my ASP.NET page. I then pick up...
2
by: Peter2 | last post by:
Hi, I have a problem posting non-ASCII characters in FORM fields between classic ASP and ASP.NET. I use a fully patched Windows 2000 Advanced Server with .net 2.0 and visual Studio 2005 installed,...
10
by: 6 | last post by:
I have an asp page with a form that collects name, email address, etc. the form page posts to itself so what I do is check to see if the request method is POST and if it is I grab the data, do...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.