|
 |
asptoday_discuss thread: Posting a form to the same page
Message #1 by "Kevin Kidson - WineNet" <kevin@w...> on Thu, 14 Feb 2002 10:19:54 +0200
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0018_01C1B541.250104D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Is there a 'generic' function to allow me to POST to the same ASP Page.
For example : I have a page called 'WineryPages_Year.asp' and on submitting
a form I want to pass information back to 'WineryPages_Year.asp'
I know I can write <form method="POST" action="WineryPages_Year.asp">
but was looking for a more generic way to post so that if I use the routine
on other pages I don't have to edit the 'WineryPages_Year.asp' every time.
Something along the lines of : <form method="POST" action="_self">
Any help much appreciated
Kevin Kidson
www.wine.co.za
The South African Wine Directory
Phone +xx xx xxx xxxx
Fax +xx xx xxx xxxx
eMail kevin@w...
Message #2 by "Joe Hughes" <JoeHughes@M...> on Thu, 14 Feb 2002 11:32:28 -0000
|
|
Hi Kevin,
You can achieve this with a bit of ASP, using the request method;
<FORM Method=POST Action="<%=Request.Servervariables("URL")%>">
This will post the Form back to current page, however it will not retain the
querystring (e.g. Default.asp?A=1&B=2)
To achieve that you can do;
<%
Sub showCurrentURL
Dim strQuerystring
Dim strURL
'# Get the querystring
strQuerystring = Request.Querystring
'# Get the current URL
strURL = Request.Servervariables("URL")
'# If we have a querystring then append it to the URL
If strQuerystring <> "" Then
strURL = strURL & "?" & strQueryString
End If
'# Write out the URL
Response.write(strURL)
End Sub
%>
<FORM Method=POST Action="<%ShowCurrentURL%>" Name=TestForm>
If not, it is possible to achieve the same using clientside javascript, but
this method is far better
HTH
Joe Hughes
----- Original Message -----
From: Kevin Kidson - WineNet
To: ASPToday Discuss
Sent: Thursday, February 14, 2002 8:19 AM
Subject: [asptoday_discuss] Posting a form to the same page
Is there a 'generic' function to allow me to POST to the same ASP Page.
For example : I have a page called 'WineryPages_Year.asp' and on submitting
a form I want to pass information back to 'WineryPages_Year.asp'
I know I can write <form method="POST" action="WineryPages_Year.asp">
but was looking for a more generic way to post so that if I use the routine
on other pages I don't have to edit the 'WineryPages_Year.asp' every time.
Something along the lines of : <form method="POST" action="_self">
Any help much appreciated
Kevin Kidson
www.wine.co.za
The South African Wine Directory
Phone +xx xx xxx xxxx
Fax +xx xx xxx xxxx
eMail kevin@w...
Message #3 by "Bill Cohen" <billcohen@h...> on Fri, 15 Feb 2002 17:16:58 +0000
|
|
Are there any ASP.NET events sponsored by Microsoft in the near future?
Thanks-
>From: "Kevin Kidson - WineNet" <kevin@w...>
>Reply-To: "ASPToday Discuss" <asptoday_discuss@p...>
>To: "ASPToday Discuss" <asptoday_discuss@p...>
>Subject: [asptoday_discuss] Posting a form to the same page
>Date: Thu, 14 Feb 2002 10:19:54 +0200
>
>Is there a 'generic' function to allow me to POST to the same ASP Page.
>
>For example : I have a page called 'WineryPages_Year.asp' and on submitting
>a form I want to pass information back to 'WineryPages_Year.asp'
>
>I know I can write <form method="POST" action="WineryPages_Year.asp">
>but was looking for a more generic way to post so that if I use the routine
>on other pages I don't have to edit the 'WineryPages_Year.asp' every time.
>
>Something along the lines of : <form method="POST" action="_self">
>
>Any help much appreciated
>Kevin Kidson
>
>www.wine.co.za
>The South African Wine Directory
>
>Phone +xx xx xxx xxxx
>Fax +xx xx xxx xxxx
>eMail kevin@w...
>
>
>
>
>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
|
|
 |