2 forms in one web app problem

E

excelleinc.com

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
 
E

excelleinc.com

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.
 
E

excelleinc.com

Ummm, forgot - method="post"


excelleinc.com said:
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.
 
P

Peter Blum

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: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top