Problem with POST method in a test form

Discussion in 'ASP General' started by Jack, Nov 9, 2004.

  1. Jack

    Jack Guest

    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>
     
    Jack, Nov 9, 2004
    #1
    1. Advertising

  2. Jack

    Bob Lehmann Guest

    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" <> wrote in message
    news:...
    > 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>
     
    Bob Lehmann, Nov 9, 2004
    #2
    1. Advertising

  3. Jack

    Jack Guest

    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" <> wrote in message
    > news:...
    > > 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>

    >
    >
    >
     
    Jack, Nov 9, 2004
    #3
  4. 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"
     
    Bob Barrows [MVP], Nov 9, 2004
    #4
  5. 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"
     
    Bob Barrows [MVP], Nov 9, 2004
    #5
  6. Jack

    Jack Guest

    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"
    >
    >
    >
     
    Jack, Nov 9, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vishal
    Replies:
    1
    Views:
    675
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
  2. Edvard Majakari
    Replies:
    4
    Views:
    687
    Edvard Majakari
    Feb 25, 2005
  3. arotem
    Replies:
    4
    Views:
    9,055
    arotem
    Oct 17, 2005
  4. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    707
    Skybuck Flying
    Oct 4, 2009
  5. Don Glover the younger

    ASP, FORMS, POST METHOD And Post with out form(???)

    Don Glover the younger, Jul 13, 2003, in forum: ASP General
    Replies:
    0
    Views:
    472
    Don Glover the younger
    Jul 13, 2003
Loading...

Share This Page