Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > 2 forms in one web app problem

Reply
Thread Tools

2 forms in one web app problem

 
 
excelleinc.com
Guest
Posts: n/a
 
      10-04-2004
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"


 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      10-04-2004
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"
<(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
 
excelleinc.com
Guest
Posts: n/a
 
      10-04-2004
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(E-Mail Removed)...
> 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"
> <(E-Mail Removed)> 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

>



 
Reply With Quote
 
excelleinc.com
Guest
Posts: n/a
 
      10-04-2004
Ummm, forgot - method="post"


"excelleinc.com" <(E-Mail Removed)> wrote in message
news:V1g8d.2052045$(E-Mail Removed)...
> 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(E-Mail Removed)...
>> 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"
>> <(E-Mail Removed)> 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

>>

>
>



 
Reply With Quote
 
Scott Allen
Guest
Posts: n/a
 
      10-04-2004
I'm glad you have it working!

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

On Mon, 04 Oct 2004 17:57:43 GMT, "excelleinc.com"
<(E-Mail Removed)> wrote:

>Ummm, forgot - method="post"
>
>
>"excelleinc.com" <(E-Mail Removed)> wrote in message
>news:V1g8d.2052045$(E-Mail Removed).. .
>> 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(E-Mail Removed)...
>>> 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"
>>> <(E-Mail Removed)> 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
>>>

>>
>>

>


 
Reply With Quote
 
Peter Blum
Guest
Posts: n/a
 
      10-05-2004
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"excelleinc.com" <(E-Mail Removed)> wrote in message
news:U_e8d.545117$(E-Mail Removed)...
> 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"
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
migrating aspx forms app to mobile forms Jeremy Chapman ASP .Net Mobile 1 06-18-2006 05:14 PM
convert java web app 2 .NET web app =?Utf-8?B?bml6YW0=?= ASP .Net 0 02-28-2006 04:45 AM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
1 server, 2 web sites 1 asp.net app each, build one, other -> Server App Unavailable Dave Diehl ASP .Net 4 08-11-2004 12:52 PM
How to secure one web app with another web app... Maras ASP .Net Security 0 06-17-2004 07:37 AM



Advertisments