473,544 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

automatic ASP page submission?

I'm trying to automatically submit a form to another ASP page after
some <input> fields values are filled by ASP.

I know I can do it using javascript, but is there a way to
automatically submit the form using VBscript?

Terry

<%
' ... some asp processing
value1 = "something"
value2 = "somethinge lse"
%>

<form method="post" action="mynextp age.asp" id="form1" name="form1">
<input TYPE="hidden" name="var1" VALUE=" & <%=value1%> & ">"
<input TYPE="hidden" name="var2" VALUE=" & <%=value2%> & ">"
</form>

<%
' form1.submit() ' this obviously wouldn't do anything
%>
<script language="JavaS cript" type="text/javascript">
// this works but is there a way to do it in vbscript.
form1.submit();
</script>

Jul 19 '05 #1
12 15550
Why do you need to if you're posting to your own page? Can't you just
execute the code on the serveR? Why create a form that has values
determined by ASP code and then submit it back to the same server?

Ray at work

"Terry" <sa********@sha w.ca> wrote in message
news:9a******** *************** *********@4ax.c om...
I'm trying to automatically submit a form to another ASP page after
some <input> fields values are filled by ASP.

I know I can do it using javascript, but is there a way to
automatically submit the form using VBscript?

Terry

<%
' ... some asp processing
value1 = "something"
value2 = "somethinge lse"
%>

<form method="post" action="mynextp age.asp" id="form1" name="form1">
<input TYPE="hidden" name="var1" VALUE=" & <%=value1%> & ">"
<input TYPE="hidden" name="var2" VALUE=" & <%=value2%> & ">"
</form>

<%
' form1.submit() ' this obviously wouldn't do anything
%>
<script language="JavaS cript" type="text/javascript">
// this works but is there a way to do it in vbscript.
form1.submit();
</script>

Jul 19 '05 #2
Terry wrote on 16 dec 2003 in microsoft.publi c.inetserver.as p.general:
I'm trying to automatically submit a form to another ASP page after
some <input> fields values are filled by ASP.

I know I can do it using javascript, but is there a way to
automatically submit the form using VBscript?

Terry

<%
' ... some asp processing
value1 = "something"
value2 = "somethinge lse"
%>

<form method="post" action="mynextp age.asp" id="form1" name="form1">
<input TYPE="hidden" name="var1" VALUE=" & <%=value1%> & ">"
<input TYPE="hidden" name="var2" VALUE=" & <%=value2%> & ">"
</form>

<%
' form1.submit() ' this obviously wouldn't do anything
%>
<script language="JavaS cript" type="text/javascript">
// this works but is there a way to do it in vbscript.
form1.submit();
</script>


<script type="text/vbscript">
form1.submit()
</script>

Only for IE !!!

Why would you want to do that ?

Are you confusing vbs with (asp)serverside and js with clientside ?

=============== ====

Would you want to do this:

<%
session("value1 ")=value1
session("value2 ")=value2
response redirect "myNextpage.asp "
%>

and on "myNextpage.asp "

<%
value1=session( "value1")
value2=session( "value2")
%>

===============

or

<%
response redirect "myNextpage.asp ?"&"value1"&"&" &"value2"
%>

and on "myNextpage.asp "

<%
value1=request. querystring("va lue1")
value2=request. querystring("va lue2")
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3
On Mon, 15 Dec 2003 18:50:51 -0500, "Ray at <%=sLocation% >"
<myfirstname at lane34 dot com> wrote:
Why do you need to if you're posting to your own page? Can't you just
execute the code on the serveR? Why create a form that has values
determined by ASP code and then submit it back to the same server?

Ray at work


Ray, Evertjan,

Thank you for the responses.

I will give a little more info. I was trying to keep it short and
probably confused things a bit by saying 'myNextPage.asp ' ... that
page is actually on a 3rd party server.

I am trying to create a standardized ASP page I can call that will
handle 2 (or more) different processing methods for credit cards. One
of our 3rd party vendors accepts a post using a querystring. The
other vendor accepts a form post. So the modified code might look
something like this:

Is there a better to handle this?

Terry

<%
' this ASP page is called by our user's payment form
' .. the page specifies which bankVendor to use.
' ... some initial processing to populate our database
value1 = "something"
value2 = "somethinge lse"
' etc.

if BankVendor="A" then
Response.redire ct "https://www.bankA.com/payment.asp?" & _
"merchant_i d=" & value1 & "&" & "OrdNum=" & value2
elseif BankVendor="B" then
%>
<form method="post" action="https://www.bankB.com/payment.asp"
id="form1" name="form1">
<input TYPE="hidden" name="merchant_ id" VALUE=" & <%=value1%> & ">"
<input TYPE="hidden" name="OrdNum" VALUE=" & <%=value2%> & ">"
</form>

<%
' if BankVendor = "B", then I want to submit the form

<script language="JavaS cript" type="text/javascript">
// this works but is there a way to do it in vbscript.
form1.submit();
</script>
end if

%>

Jul 19 '05 #4
"Terry" <sa********@sha w.ca> wrote in message
news:p4******** *************** *********@4ax.c om...
On Mon, 15 Dec 2003 18:50:51 -0500, "Ray at <%=sLocation% >"
<myfirstname at lane34 dot com> wrote:
Why do you need to if you're posting to your own page? Can't you justexecute the code on the serveR? Why create a form that has values
determined by ASP code and then submit it back to the same server?

Ray at work


Ray, Evertjan,

Thank you for the responses.

I will give a little more info. I was trying to keep it short and
probably confused things a bit by saying 'myNextPage.asp ' ... that
page is actually on a 3rd party server.

I am trying to create a standardized ASP page I can call that will
handle 2 (or more) different processing methods for credit cards. One
of our 3rd party vendors accepts a post using a querystring. The
other vendor accepts a form post. So the modified code might look
something like this:

Is there a better to handle this?

Terry

<%
' this ASP page is called by our user's payment form
' .. the page specifies which bankVendor to use.
' ... some initial processing to populate our database
value1 = "something"
value2 = "somethinge lse"
' etc.

if BankVendor="A" then
Response.redire ct "https://www.bankA.com/payment.asp?" & _
"merchant_i d=" & value1 & "&" & "OrdNum=" & value2
elseif BankVendor="B" then
%>
<form method="post" action="https://www.bankB.com/payment.asp"
id="form1" name="form1">
<input TYPE="hidden" name="merchant_ id" VALUE=" & <%=value1%> & ">"
<input TYPE="hidden" name="OrdNum" VALUE=" & <%=value2%> & ">"
</form>

<%
' if BankVendor = "B", then I want to submit the form

<script language="JavaS cript" type="text/javascript">
// this works but is there a way to do it in vbscript.
form1.submit();
</script>
end if

%>


The following article has a section devoted to posting to an external
resource using MSXML.
http://aspfaq.com/2173

HTH
-Chris Hohmann
Jul 19 '05 #5
Use the link that Chris posted. Are you trying to jerry-rig thins though?
One of your vendors instructs you to grab data from their website and put it
in your own? You'd think they'd offer something to do this for you.

Ray at work

"Terry" <sa********@sha w.ca> wrote in message
news:p4******** *************** *********@4ax.c om...
I will give a little more info. I was trying to keep it short and
probably confused things a bit by saying 'myNextPage.asp ' ... that
page is actually on a 3rd party server.

I am trying to create a standardized ASP page I can call that will
handle 2 (or more) different processing methods for credit cards. One
of our 3rd party vendors accepts a post using a querystring. The
other vendor accepts a form post. So the modified code might look
something like this:

Is there a better to handle this?

Jul 19 '05 #6
Thanks for the great link. That does it.

But just to clarify... I think you might still be confused on my
setup. The initial user form is on our site, which then calls the ASP
page I am referring to (again on our site), and that decides to which
of the other two external sites it is posted to, depending on the bank
type.

thanks again ... Terry
On Mon, 15 Dec 2003 20:06:28 -0500, "Ray at <%=sLocation% >"
<myfirstname at lane34 dot com> wrote:
Use the link that Chris posted. Are you trying to jerry-rig thins though?
One of your vendors instructs you to grab data from their website and put it
in your own? You'd think they'd offer something to do this for you.

Ray at work

"Terry" <sa********@sha w.ca> wrote in message
news:p4******* *************** **********@4ax. com...
I will give a little more info. I was trying to keep it short and
probably confused things a bit by saying 'myNextPage.asp ' ... that
page is actually on a 3rd party server.

I am trying to create a standardized ASP page I can call that will
handle 2 (or more) different processing methods for credit cards. One
of our 3rd party vendors accepts a post using a querystring. The
other vendor accepts a form post. So the modified code might look
something like this:

Is there a better to handle this?


Jul 19 '05 #7
Thought I had it, but on further review, it is still not working
right.

When I use 'MSXML2.ServerX MLHTTP' to post the page, the resulting URL
that appears ends up being on my computer, rather than the remote
server. So then the resulting buttons on THAT page fail, since they
are referencing relatively ( I suppose).

Am I missing something? Or could it mean there is an installation
problem of MSXML2 on my ISP's server. Any other suggestions?

Terry
Here are the two sample pages:

The html form I would like to simulate (this page will work if you
paste it)
test.html:

<HTML>
<HEAD>
<FORM METHOD="POST"
ACTION="https://esqa.moneris.co m/hosted/index.php">
<INPUT TYPE="HIDDEN" NAME="store_id" VALUE="store1">
<INPUT TYPE="HIDDEN" NAME="charge_to tal" VALUE="1.01">
<INPUT TYPE="HIDDEN" NAME="return_UR L"
VALUE="http://www.yahoo.com">
<INPUT TYPE="HIDDEN" NAME="receipt_U RL"
VALUE="http://www.yahoo.com">
<INPUT TYPE="HIDDEN" NAME="hide_item " VALUE="1">
<INPUT TYPE="HIDDEN" NAME="hide_addr ess" VALUE="1">
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Click to proceed to
Secure Page">
</FORM>
</HEAD>
</HTML>

THE ASP page that should(?) submit the info automatically for me:
but, when I run this page, instead of
'https://esqa.moneris.co m/hosted/index.php' appearing in my Browser
address bar, it shows: http://mycomputer/mypath/test2.asp
It might be useful if someone could run this on their server (with
good MSXML2 install) to let me know if they get the same as the HTML
form above, or the same as I do.
=============== =========
test2.asp:

<%@ Language=VBScri pt %>
<HTML>
<HEAD>

<%
dim xmlhttp
url = "https://esqa.moneris.co m/hosted/index.php"
set xmlhttp = server.CreateOb ject("MSXML2.Se rverXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.setRequ estHeader "Content-Type",
"applicatio n/x-www-form-urlencoded"

formdata="store _id=store1&" & _
"charge_total=1 .01&" & _
"return_URL = www.yahoo.com&" & _
"receipt_URL=ww w.yahoo.com&" & _
"hide_items =1&" & _
"hide_address=1 "

xmlhttp.send formdata
Response.write xmlhttp.respons eText
set xmlhttp = nothing
%>
</HEAD>
</HTML>



On Mon, 15 Dec 2003 20:06:28 -0500, "Ray at <%=sLocation% >"
<myfirstname at lane34 dot com> wrote:
Use the link that Chris posted. Are you trying to jerry-rig thins though?
One of your vendors instructs you to grab data from their website and put it
in your own? You'd think they'd offer something to do this for you.

Ray at work

"Terry" <sa********@sha w.ca> wrote in message
news:p4******* *************** **********@4ax. com...
I will give a little more info. I was trying to keep it short and
probably confused things a bit by saying 'myNextPage.asp ' ... that
page is actually on a 3rd party server.

I am trying to create a standardized ASP page I can call that will
handle 2 (or more) different processing methods for credit cards. One
of our 3rd party vendors accepts a post using a querystring. The
other vendor accepts a form post. So the modified code might look
something like this:

Is there a better to handle this?


Jul 19 '05 #8
Terry wrote on 16 dec 2003 in microsoft.publi c.inetserver.as p.general:
Here are the two sample pages:

The html form I would like to simulate (this page will work if you
paste it)
test.html:

<HTML>
<HEAD>
<FORM METHOD="POST"
ACTION="https://esqa.moneris.co m/hosted/index.php">
<INPUT TYPE="HIDDEN" NAME="store_id" VALUE="store1">
<INPUT TYPE="HIDDEN" NAME="charge_to tal" VALUE="1.01">
<INPUT TYPE="HIDDEN" NAME="return_UR L"
VALUE="http://www.yahoo.com">
<INPUT TYPE="HIDDEN" NAME="receipt_U RL"
VALUE="http://www.yahoo.com">
<INPUT TYPE="HIDDEN" NAME="hide_item " VALUE="1">
<INPUT TYPE="HIDDEN" NAME="hide_addr ess" VALUE="1">
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Click to proceed to
Secure Page">
</FORM>
</HEAD>
</HTML>


I think you are making to many problems for yourself.
why not simply startout with:

=============== =============== ======

<HTML>

<% bank=session("b ankname") %>

<body
onload="documen t.getElementByI d(""myform"").s ubmit()">

<% if bank = "bankA" then %>

<FORM METHOD="POST" id="myform">
ACTION="https://esqa.moneris.co m/hosted/index.php">
<INPUT TYPE="HIDDEN" NAME="store_id" VALUE="store1">
<INPUT TYPE="HIDDEN" NAME="charge_to tal" VALUE="1.01">
<INPUT TYPE="HIDDEN" NAME="hide_item " VALUE="1">
<INPUT TYPE="HIDDEN" NAME="hide_addr ess" VALUE="1">
</FORM>

<% elseif bank = "bankB" then %>

<FORM METHOD="POST" id="myform">
ACTION="https://Bank.b.com/index.php">
<INPUT TYPE="HIDDEN" NAME="store_id" VALUE="store1">
<INPUT TYPE="HIDDEN" NAME="charge_to tal" VALUE="1.01">
<INPUT TYPE="HIDDEN" NAME="hide_item " VALUE="1">
<INPUT TYPE="HIDDEN" NAME="hide_addr ess" VALUE="1">
</FORM>

<% elseif bank = "bankC" then %>

<FORM METHOD="POST" id="myform">
ACTION="https://bank.C.com/hosted/index.php">
<INPUT TYPE="HIDDEN" NAME="store_id" VALUE="store1">
<INPUT TYPE="HIDDEN" NAME="charge_to tal" VALUE="1.01">
<INPUT TYPE="HIDDEN" NAME="hide_item " VALUE="1">
<INPUT TYPE="HIDDEN" NAME="hide_addr ess" VALUE="1">
</FORM>

<% ' else - errorcode for other banks here later? %>

<% end if %>

</Body>
</HTML>

=============== =============== ===

If this works then you can change the codes for the individual banks,
possibly also adding bankspecific serverside code.

You could write the above far mor efficiently,
but the layout of the code would be less clear.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #9
Evertjan. wrote on 16 dec 2003 in microsoft.publi c.inetserver.as p.general:
<FORM METHOD="POST" id="myform">
ACTION="https://bank.C.com/hosted/index.php">


<FORM METHOD="POST" id="myform"
ACTION="https://bank.C.com/hosted/index.php">
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2072
by: Eric Linders | last post by:
Hello, Our company currently processes a few hundred form submissions through our site. Up till now, the contents of the form has been sent to our customer support staff in real-time. Each submission goes to a general e-mail box where it's printed through our mail client. A copy of the form is also stored in a MySQL db, although it's not...
5
5173
by: Alex Hunsley | last post by:
I'm using urllib to post data to a web form by issuing a command similar to this: filename, headers = urllib.urlretrieve("http://www.thewebsitenamehere.com/servlet/com.blah.bloo.XmlFeed", "content.txt", None, urllib.urlencode({"aParameter": "theValue"})) Now, the problem is that the above fails, since I am not sending a session cookie....
10
3161
by: Manny | last post by:
I have a web form "Page1.asp" and it reads data from a database, does some calculations, and displays the records in pages. Works fine. I have a button that displays on the page, defined as <input type="button" onClick="OutputData()"> The OutputData() function is a javascript function that simply does this: window.location =...
1
2568
by: Piotr Kurpiel | last post by:
Hi, I am creating a site where I need to refer to another external file (aspx). I create the form and works fine. But as soon as I try to submit the form automatically (with form.submit()) I get an error from the external site. I do not have the code of that site but suppose that my automatic submission does not pass all of the variables....
12
22086
by: Stanley | last post by:
Hi, I'd like to write a HTML page which can help me directly log in my Yahoo!mail or Gmail account without typing user name and password. Basically, I want to set up a link, click it and pop up the Yahoo/Gmail page. What technology is most appropriate for this kind of work? My current solution is not so satisfying: I download...
6
4848
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still...
7
2971
by: grpmangr | last post by:
hi Is ther anyway i can automatically fill out forms and submit them thru java? supposing i hav a normal txt file that contains all data that needs to be filed out into the form, is there anyway i can fill out a form and submit it automatically by providing only the URL of the form and the txt file? thanks Najla
4
2816
by: Scott Shuster | last post by:
Hi, I've been searching and testing and have not yet found the answer I'm looking for. I have an ASP.NET (vb) application with an ecommerce function. When the user submits the page, I DON'T want them to be able to click on the 'BACK' button and get back to the form - they may inadvertently re-submit the page and get charged again. I...
6
3287
by: chazzy69 | last post by:
Ok two questions- First is it possible to replicate javascripts automatic submit with a php function, i want to do this due to the fact we i run a cron job it wont run javascript. Second If the above is not possible i need to transfer information from the intial page to another another .php and acts similar to the php form in that when u hit...
0
7387
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5316
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4938
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1862
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
688
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.