Click to See Complete Forum and Search --> : form action doesnot work??
akalya
Nov 7th, 2003, 10:22 PM
Hi
I tried to post a form to another form.. but the form is not submitted to the form specified in the action property..
Eg. In webform2.aspx
<form method="post" action="webform3.aspx">
but the form is submitted to webform2.aspx??
wot to do if i need to submit to a different form??
if i cant submit to a different form, then why is the action attribute allowed in form element??
thanks
Akalya
Musician
Nov 8th, 2003, 06:52 PM
I dont know why it allows a method in an asp.net form because any asp.net form (i.e. with runat=server) will always post to itself.
I highly recommend you consider using this model because it works quite well and in most cases posting from one form to another can be avoided.
If however you really need to do so there are ways to do it without posting the form to another page using cookies or session variables and then redirecting to your second page.
akalya
Nov 10th, 2003, 11:42 PM
Hi
Thanks for ur reply...Wot u say is to assign the values of all the form values to cookies or session variables and then redirect to the form i want to post it to..
But cookies cannot be used since the user may be disabled cookies.. disabling cookies will also prevent using session variables since sessionid is stored in the client machine..
Is the only way to send the form variables in the form of querystring??
Akalya
PJ6
Nov 11th, 2003, 03:13 AM
no u can still use request.form if u use htmlcontrols. if u gonna use servercontrol u need to use their text proberty.
small example:
<%@ Page Language="VBScript" Debug="true" %>
<script runat="server" language="vb">
Sub btnsubmit_click(Sender As Object, E As EventArgs)
response.Write("HtmlControl: " + request.Form("htmlcontrol"))
response.Write("<br>ServerControl: " + servercontrol.text)
End Sub
</script>
<html>
<body>
<form runat="server">
<input type="text" name="htmlcontrol">
<asp:TextBox ID="servercontrol" runat="server" />
<asp:Button ID="submitbtn" runat="server" OnClick="btnsubmit_click" Text="submit" />
</form>
</body>
</html>
akalya
Nov 12th, 2003, 11:13 PM
Hi
wot u did is posted to the same form.. wot do u do to post it to a diff form??
u cannot access this way?.. the only soln is to redirect and use session/Cookie variables or redirect to a page with query string attached.. Am i right
thanks
PJ6
Nov 13th, 2003, 07:10 AM
hmmm, havnt tried it yet to post to a diff form, cuz there was no need to. i think posting to the same page is one of the great benefits asp.net supports, and u can save through this a lot of pages.
but to ur question, it should be still possible if u only use htmlcontrols or when ur form tag has no runat=server method, maybe u give this a try.
greetings
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.