2 forms in one web app problem

Discussion in 'ASP .Net' started by excelleinc.com, Oct 4, 2004.

  1. Hello,

    I have 2 forms to be filled by user, one is "auth" and second one contact
    form. They're completely independent.

    Problem is that when I enclose them within same <form runat="server"> tag
    one can't submit without another one (RequiredField Validator) and I'm
    having whole kind of problems because .net is seeing it as one form.

    If I put second <form runat="Server"> I'm getting error that I can't use
    more than one form in one page.

    Is there any ways around this?

    Thanks In Advance,

    Vlado

    --
    Vlado Jasovic
    Excelle Technologies Inc.
    http://www.excelleinc.com
    "single source for all your computer needs"
     
    excelleinc.com, Oct 4, 2004
    #1
    1. Advertising

  2. excelleinc.com

    Scott Allen Guest

    Hi Vlado:

    There is a good article with background information on why ASP.NET
    behaves this way, and models to work around the limitation here:

    Form-based Programming in ASP.NET
    http://msdn.microsoft.com/msdnmag/issues/03/05/CuttingEdge/default.aspx

    --
    Scott
    http://www.OdeToCode.com/

    On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
    <> wrote:

    >Hello,
    >
    >I have 2 forms to be filled by user, one is "auth" and second one contact
    >form. They're completely independent.
    >
    >Problem is that when I enclose them within same <form runat="server"> tag
    >one can't submit without another one (RequiredField Validator) and I'm
    >having whole kind of problems because .net is seeing it as one form.
    >
    >If I put second <form runat="Server"> I'm getting error that I can't use
    >more than one form in one page.
    >
    >Is there any ways around this?
    >
    >Thanks In Advance,
    >
    >Vlado
     
    Scott Allen, Oct 4, 2004
    #2
    1. Advertising

  3. Thanks Scott for great link.

    I have decided to go with HTML form redirecting to separate aspx page but
    for some reason it's not passing the values. I've checked the syntax 100000+
    times.

    login.aspx
    ---------------------------------
    <form class="font" action="checklogin.aspx">
    E-Mail Address: <input name="Cust_EMail" id="Cust_EMail" type="text"
    class="font" width="50" />
    <br>
    Password:<input name="Cust_Password" id="Cust_PAssword" type="password"
    class="font" width="50" />
    <br>
    <asp:Label ID="login_error" runat="server" Text="Login failed. Please try
    again." Visible="false" CssClass="red" />
    <input type="submit" name="Submit" value="Send" class="font">
    <br>
    <a href="passwordremainder.aspx"
    onclick="NewWindow(this.href,'name','510','240','yes');return false;">forgot
    your password?</a>
    </form>


    checklogin.aspx
    -----------------------------------
    <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1"
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <script language="vb" runat="server">
    Sub Page_Load(obj as object, e as eventargs)
    Response.Write("email=" & Request.Form("Cust_EMail") & ", password=" &
    Request.Form("Cust_Password"))
    End Sub
    </script>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>
    <body>
    </body>
    </html>


    I'm getting no values, I don't know what can be wrong, it's very
    frustrating.


    "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    news:p...
    > Hi Vlado:
    >
    > There is a good article with background information on why ASP.NET
    > behaves this way, and models to work around the limitation here:
    >
    > Form-based Programming in ASP.NET
    > http://msdn.microsoft.com/msdnmag/issues/03/05/CuttingEdge/default.aspx
    >
    > --
    > Scott
    > http://www.OdeToCode.com/
    >
    > On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
    > <> wrote:
    >
    >>Hello,
    >>
    >>I have 2 forms to be filled by user, one is "auth" and second one contact
    >>form. They're completely independent.
    >>
    >>Problem is that when I enclose them within same <form runat="server"> tag
    >>one can't submit without another one (RequiredField Validator) and I'm
    >>having whole kind of problems because .net is seeing it as one form.
    >>
    >>If I put second <form runat="Server"> I'm getting error that I can't use
    >>more than one form in one page.
    >>
    >>Is there any ways around this?
    >>
    >>Thanks In Advance,
    >>
    >>Vlado

    >
     
    excelleinc.com, Oct 4, 2004
    #3
  4. Ummm, forgot - method="post"


    "excelleinc.com" <> wrote in message
    news:V1g8d.2052045$...
    > Thanks Scott for great link.
    >
    > I have decided to go with HTML form redirecting to separate aspx page but
    > for some reason it's not passing the values. I've checked the syntax
    > 100000+ times.
    >
    > login.aspx
    > ---------------------------------
    > <form class="font" action="checklogin.aspx">
    > E-Mail Address: <input name="Cust_EMail" id="Cust_EMail" type="text"
    > class="font" width="50" />
    > <br>
    > Password:<input name="Cust_Password" id="Cust_PAssword" type="password"
    > class="font" width="50" />
    > <br>
    > <asp:Label ID="login_error" runat="server" Text="Login failed. Please
    > try again." Visible="false" CssClass="red" />
    > <input type="submit" name="Submit" value="Send" class="font">
    > <br>
    > <a href="passwordremainder.aspx"
    > onclick="NewWindow(this.href,'name','510','240','yes');return
    > false;">forgot your password?</a>
    > </form>
    >
    >
    > checklogin.aspx
    > -----------------------------------
    > <%@ Page Language="VB" ContentType="text/html"
    > ResponseEncoding="iso-8859-1" %>
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    > <script language="vb" runat="server">
    > Sub Page_Load(obj as object, e as eventargs)
    > Response.Write("email=" & Request.Form("Cust_EMail") & ", password=" &
    > Request.Form("Cust_Password"))
    > End Sub
    > </script>
    > <html>
    > <head>
    > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    > <title>Untitled Document</title>
    > </head>
    > <body>
    > </body>
    > </html>
    >
    >
    > I'm getting no values, I don't know what can be wrong, it's very
    > frustrating.
    >
    >
    > "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    > news:p...
    >> Hi Vlado:
    >>
    >> There is a good article with background information on why ASP.NET
    >> behaves this way, and models to work around the limitation here:
    >>
    >> Form-based Programming in ASP.NET
    >> http://msdn.microsoft.com/msdnmag/issues/03/05/CuttingEdge/default.aspx
    >>
    >> --
    >> Scott
    >> http://www.OdeToCode.com/
    >>
    >> On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
    >> <> wrote:
    >>
    >>>Hello,
    >>>
    >>>I have 2 forms to be filled by user, one is "auth" and second one contact
    >>>form. They're completely independent.
    >>>
    >>>Problem is that when I enclose them within same <form runat="server"> tag
    >>>one can't submit without another one (RequiredField Validator) and I'm
    >>>having whole kind of problems because .net is seeing it as one form.
    >>>
    >>>If I put second <form runat="Server"> I'm getting error that I can't use
    >>>more than one form in one page.
    >>>
    >>>Is there any ways around this?
    >>>
    >>>Thanks In Advance,
    >>>
    >>>Vlado

    >>

    >
    >
     
    excelleinc.com, Oct 4, 2004
    #4
  5. excelleinc.com

    Scott Allen Guest

    I'm glad you have it working!

    --
    Scott
    http://www.OdeToCode.com/

    On Mon, 04 Oct 2004 17:57:43 GMT, "excelleinc.com"
    <> wrote:

    >Ummm, forgot - method="post"
    >
    >
    >"excelleinc.com" <> wrote in message
    >news:V1g8d.2052045$...
    >> Thanks Scott for great link.
    >>
    >> I have decided to go with HTML form redirecting to separate aspx page but
    >> for some reason it's not passing the values. I've checked the syntax
    >> 100000+ times.
    >>
    >> login.aspx
    >> ---------------------------------
    >> <form class="font" action="checklogin.aspx">
    >> E-Mail Address: <input name="Cust_EMail" id="Cust_EMail" type="text"
    >> class="font" width="50" />
    >> <br>
    >> Password:<input name="Cust_Password" id="Cust_PAssword" type="password"
    >> class="font" width="50" />
    >> <br>
    >> <asp:Label ID="login_error" runat="server" Text="Login failed. Please
    >> try again." Visible="false" CssClass="red" />
    >> <input type="submit" name="Submit" value="Send" class="font">
    >> <br>
    >> <a href="passwordremainder.aspx"
    >> onclick="NewWindow(this.href,'name','510','240','yes');return
    >> false;">forgot your password?</a>
    >> </form>
    >>
    >>
    >> checklogin.aspx
    >> -----------------------------------
    >> <%@ Page Language="VB" ContentType="text/html"
    >> ResponseEncoding="iso-8859-1" %>
    >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    >> "http://www.w3.org/TR/html4/loose.dtd">
    >> <script language="vb" runat="server">
    >> Sub Page_Load(obj as object, e as eventargs)
    >> Response.Write("email=" & Request.Form("Cust_EMail") & ", password=" &
    >> Request.Form("Cust_Password"))
    >> End Sub
    >> </script>
    >> <html>
    >> <head>
    >> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    >> <title>Untitled Document</title>
    >> </head>
    >> <body>
    >> </body>
    >> </html>
    >>
    >>
    >> I'm getting no values, I don't know what can be wrong, it's very
    >> frustrating.
    >>
    >>
    >> "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    >> news:p...
    >>> Hi Vlado:
    >>>
    >>> There is a good article with background information on why ASP.NET
    >>> behaves this way, and models to work around the limitation here:
    >>>
    >>> Form-based Programming in ASP.NET
    >>> http://msdn.microsoft.com/msdnmag/issues/03/05/CuttingEdge/default.aspx
    >>>
    >>> --
    >>> Scott
    >>> http://www.OdeToCode.com/
    >>>
    >>> On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
    >>> <> wrote:
    >>>
    >>>>Hello,
    >>>>
    >>>>I have 2 forms to be filled by user, one is "auth" and second one contact
    >>>>form. They're completely independent.
    >>>>
    >>>>Problem is that when I enclose them within same <form runat="server"> tag
    >>>>one can't submit without another one (RequiredField Validator) and I'm
    >>>>having whole kind of problems because .net is seeing it as one form.
    >>>>
    >>>>If I put second <form runat="Server"> I'm getting error that I can't use
    >>>>more than one form in one page.
    >>>>
    >>>>Is there any ways around this?
    >>>>
    >>>>Thanks In Advance,
    >>>>
    >>>>Vlado
    >>>

    >>
    >>

    >
     
    Scott Allen, Oct 4, 2004
    #5
  6. excelleinc.com

    Peter Blum Guest

    While I realize that you have worked around this, it may help to know that
    there are solutions which don't require splitting into two forms.

    1. ASP.NET 2.0 (now in Beta and due in the first half of 2005) offers a new
    feature on validators: "Validation Groups". Its a new property on the
    validators and submit buttons where you assign a name to a button and all
    validators that it fires.

    2. I have built a replacement to the ASP.NET Validators that includes
    validation groups and goes far beyond what ASP.NET 2.0 will offer.
    Professional Validation And More (http://www.peterblum.com/vam/home.aspx)
    includes 22 validators. They provide client side validation on many more
    browsers (like Netscape/Mozilla/FireFox, Opera 7 and Safari).

    3. If you disable client-side validation on that page (set
    EnableClientScript to false on each validator), you can do the following to
    validate only the fields associated with the submit button:
    - Set the button's CausesValidation to false
    - In the Click event handler, call Validate() on each individual validator
    that this button supports. Then test its IsValid property. If all are valid,
    you can save.

    --- Peter Blum
    www.PeterBlum.com
    Email:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "excelleinc.com" <> wrote in message
    news:U_e8d.545117$...
    > Hello,
    >
    > I have 2 forms to be filled by user, one is "auth" and second one contact
    > form. They're completely independent.
    >
    > Problem is that when I enclose them within same <form runat="server"> tag
    > one can't submit without another one (RequiredField Validator) and I'm
    > having whole kind of problems because .net is seeing it as one form.
    >
    > If I put second <form runat="Server"> I'm getting error that I can't use
    > more than one form in one page.
    >
    > Is there any ways around this?
    >
    > Thanks In Advance,
    >
    > Vlado
    >
    > --
    > Vlado Jasovic
    > Excelle Technologies Inc.
    > http://www.excelleinc.com
    > "single source for all your computer needs"
    >
     
    Peter Blum, Oct 5, 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. Dave Diehl
    Replies:
    4
    Views:
    842
    Dave Diehl
    Aug 11, 2004
  2. =?Utf-8?B?bml6YW0=?=

    convert java web app 2 .NET web app

    =?Utf-8?B?bml6YW0=?=, Feb 28, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    413
    =?Utf-8?B?bml6YW0=?=
    Feb 28, 2006
  3. Jeremy Chapman

    migrating aspx forms app to mobile forms

    Jeremy Chapman, Jun 15, 2006, in forum: ASP .Net Mobile
    Replies:
    1
    Views:
    756
    Christoph Richter [AT]
    Jun 18, 2006
  4. Maras
    Replies:
    0
    Views:
    134
    Maras
    Jun 17, 2004
  5. Eric
    Replies:
    2
    Views:
    643
Loading...

Share This Page