|
| |
|
|
Joey
Posts: 167 Joined: 5/15/2002 From: Status: offline
|
Form Auto Post - 1/18/2008 10:49:14
I need to automatically submit the form when the following string is sent: /test.asp?test=123 <form method="POST" action="test2.asp">
<p>
<input type="text" name="test" size="20" value="<%=Server.HtmlEncode(Request("test"))%>"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form> I think this is called an http post but i'm really not sure.
|
|
|
|
rdouglass
Posts: 9229 From: Biddeford, ME USA Status: offline
|
RE: Form Auto Post - 1/18/2008 11:55:40
quote:
<form method="POST" action="test2.asp"> This should work - I do it all the time: Identify the form like this: <form method="POST" action="test2.asp" name="myform"> Then, at the bottom of the page just before the </body> tag, put this: <%IF Request.querystring("test") = "123" THEN%> <script language="javascript"> document.forms["myform"].submit(); </script> <%END IF%> That should submit the form automatically if the querystring has "test=123" in it. That help any?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Joey
Posts: 167 Joined: 5/15/2002 From: Status: offline
|
RE: Form Auto Post - 1/18/2008 12:02:10
That works great, thanks again Roger.
< Message edited by Joey -- 1/18/2008 15:52:24 >
|
|
|
|
Joey
Posts: 167 Joined: 5/15/2002 From: Status: offline
|
RE: Form Auto Post - 1/19/2008 0:38:32
The code works great when i use it in a browser as a hyperlink with parameters "test.com/test=123" This page is supposed to automatically post back when a server posts the results to the url, since it is not a browser doing the post, the form never sends with a server visit <html><body>
form method="POST" action="postbackserver.com/postback.asp">
<p>
<input type="text" name="test" size="20" value="<%=Request.Form(Request("test"))%><%IF Request.Form("test") = "123" THEN%> <script language="javascript"> document.forms["myform"].submit();
</script>
<%END IF%>
</body></html>
Its a automated postback. Anyone know how to do that?
|
|
|
|
rdouglass
Posts: 9229 From: Biddeford, ME USA Status: offline
|
RE: Form Auto Post - 1/19/2008 10:39:58
What else is on that page? Does it do anything else? If it doesn't, would something like Response.redirect work with GET data or does it have to be POST? POST would use a form and GET would use querystrings like Response.redirect("/test.asp?test=" & Request.querystring("test")) Maybe? If not, then I'm probably not clear as to what is specifically happening.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Joey
Posts: 167 Joined: 5/15/2002 From: Status: offline
|
RE: Form Auto Post - 1/19/2008 12:04:23
It needs to post back. the application is simular to how the paypal ipn posts back to paypal. I'm not sure how to do it with this simple form. Here is how paypal code posts back: <!--#include file="include/dbcommon.asp"-->
<%
on error goto 0
'------------------------------------------------------------------
' Open log file (in append mode) and write the current time into it.
' Open the DB Connection. Open the actual database.
'-------------------------------------------------------------------
'------------------------------------------------
' Read post from PayPal system and create reply
' starting with: 'cmd=_notify-validate'...
' then repeating all values sent - VALIDATION.
'------------------------------------------------
req = "cmd=_notify-validate"
for each key in Request.Form
req = req & "&" & key & "=" & server.URLEncode(Request.Form(key))
next
'--------------------------------------------
' Create message to post back to PayPal...
'--------------------------------------------
dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://www.paypal.com/cgi-bin/webscr"
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send req
dim res
res=xmlhttp.responseText
Set xmlhttp = nothing
if res<>"VERIFIED" then
response.end
end if
if request.form("payment_status")<>"Completed" then
rexponse.end
end if
'update order status
dbConnection=""
db_connect()
sql = "update sales_order_main set status='PAYMENT RECEIVED' where Order_no=" & request.form("item_number")
dbConnection.Execute sql
dbConnection.Close
set dbConnection=nothing
%>
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|