...

View Full Version : Submit form on event



K-PRO
07-11-2008, 10:55 PM
i have a paypal button code which is basically a form that gets submitted

the code for the button wud be like this


<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="email">
<input type="hidden" name="item_name" value="cd name">
<input type="hidden" name="item_number" value="36676y">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="shipping" value="1.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="weight" value="1">
<input type="hidden" name="weight_unit" value="lbs">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

and i want to make a page that when it loads it submits that form and sends the values to paypal so it shows the payment page for my product

i wanna do this coz most forums have disabled HTML in posts and i am advertising sumthing for sale

so i wanna create a page for example sales... wud submit the info and redirect the user to paypal account that was submitted

so basically how to activate the submit button on load event ?

thanx

jcdevelopment
07-11-2008, 11:13 PM
did you want something like this



onsubmit="window.location='index.htm'


so it would be this



<form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="window.location='paypal site.html';">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="email">
<input type="hidden" name="item_name" value="cd name">
<input type="hidden" name="item_number" value="36676y">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="shipping" value="1.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="weight" value="1">
<input type="hidden" name="weight_unit" value="lbs">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

K-PRO
07-11-2008, 11:20 PM
no no

i meant as soon as i open the page it submits the form
so basically no need to click the button

when i open the page it performs the action

_Aerospace_Eng_
07-12-2008, 12:58 AM
You need to give the form a name or an id.

<form name="theform" id="theform">
then you can use

document.forms['theform'].submit();
or

document.getElementById('theform').submit();
but you need to put it towards the bottom of the page to make sure the form as loaded completely or you can use window.onload

window.onload = function()
{
// submit the form
}

K-PRO
07-12-2008, 02:00 AM
when i insert those it displays it as text in the page and doesnt really define it as a code
i tried all 3 codes

from what i know (and i dnt know much) that they shud be in some sort of function ?
i dont know please help me

thank you

_Aerospace_Eng_
07-12-2008, 02:16 AM
You were supposed to put those inside of script elements

<script type="text/javascript">// insert what I gave you here</script>
I suggest you actually learn how to do this stuff. Do some more tutorials. This stuff is basic.

K-PRO
07-12-2008, 02:32 AM
oops sorry... lol i didnt think much m kinda exhausted
works so sweet i cant believe it

thanx alot



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum