Connecting Tech Pros Worldwide Forums | Help | Site Map

2 forms in one web app problem

excelleinc.com
Guest
 
Posts: n/a
#1: Nov 18 '05
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"



Scott Allen
Guest
 
Posts: n/a
#2: Nov 18 '05

re: 2 forms in one web app problem


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/is...e/default.aspx

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

On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
<vjasovic@excelleinc.com> wrote:
[color=blue]
>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[/color]

excelleinc.com
Guest
 
Posts: n/a
#3: Nov 18 '05

re: 2 forms in one web app problem


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','y es');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:po03m09bic0slig8p9g58fcmos2a0bggib@4ax.com...[color=blue]
> 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/is...e/default.aspx
>
> --
> Scott
> http://www.OdeToCode.com/
>
> On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
> <vjasovic@excelleinc.com> wrote:
>[color=green]
>>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[/color]
>[/color]


excelleinc.com
Guest
 
Posts: n/a
#4: Nov 18 '05

re: 2 forms in one web app problem


Ummm, forgot - method="post"


"excelleinc.com" <vjasovic@excelleinc.com> wrote in message
news:V1g8d.2052045$ic1.209282@news.easynews.com...[color=blue]
> 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','y es');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:po03m09bic0slig8p9g58fcmos2a0bggib@4ax.com...[color=green]
>> 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/is...e/default.aspx
>>
>> --
>> Scott
>> http://www.OdeToCode.com/
>>
>> On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
>> <vjasovic@excelleinc.com> wrote:
>>[color=darkred]
>>>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[/color]
>>[/color]
>
>[/color]


Scott Allen
Guest
 
Posts: n/a
#5: Nov 18 '05

re: 2 forms in one web app problem


I'm glad you have it working!

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

On Mon, 04 Oct 2004 17:57:43 GMT, "excelleinc.com"
<vjasovic@excelleinc.com> wrote:
[color=blue]
>Ummm, forgot - method="post"
>
>
>"excelleinc.com" <vjasovic@excelleinc.com> wrote in message
>news:V1g8d.2052045$ic1.209282@news.easynews.com.. .[color=green]
>> 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','y es');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:po03m09bic0slig8p9g58fcmos2a0bggib@4ax.com...[color=darkred]
>>> 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/is...e/default.aspx
>>>
>>> --
>>> Scott
>>> http://www.OdeToCode.com/
>>>
>>> On Mon, 04 Oct 2004 16:37:08 GMT, "excelleinc.com"
>>> <vjasovic@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
>>>[/color]
>>
>>[/color]
>[/color]

Peter Blum
Guest
 
Posts: n/a
#6: Nov 18 '05

re: 2 forms in one web app problem


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: PLBlum@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"excelleinc.com" <vjasovic@excelleinc.com> wrote in message
news:U_e8d.545117$yk.90932@news.easynews.com...[color=blue]
> 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"
>[/color]


Closed Thread