/    Sign up×
Community /Pin to ProfileBookmark

Submit Form onLoad

I am trying to get a form to submit onLoad. It is not working (obviously). Here is my code:

[code]
<body onload=”document.forms[‘pop_up’].submit()”>

<table class=”special” style=”width:700px”>
<tr>
<td style=”border:thin groove silver;”>
If you wish to pay this account electronically rather than be billed, click “Pay Now” to be redirected to a
secure 3rd-party online credit card processor. If you chose to pay online and are not automatically redirected
within 10 seconds you can click this button.
<form name=”pop_up” method=”post”
action=”../../home/misc/pay_online.asp?from=resubscribe&amp;curr_length=<%=sCurrLength%>”
target=”_blank”>
<input type=”submit” name=”submit” id=”submit” style=”font-size:8pt” value=”Pay Now” />
</form>
</td>
</tr>
[/code]

Any help would be much appreciated! Thanks!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@methodpgDec 30.2005 — Does [CODE]document.pop_up.submit()[/CODE] work??
Copy linkTweet thisAlerts:
@bobbabuoyauthorDec 30.2005 — No that didn't work either. Here is the exact code that I am using.
<i>
</i>&lt;body
&lt;%If bFirstLoad = True Then%&gt;
onload="document.pop_up.submit()"
&lt;%End If%&gt;
<i>&gt;</i>

&lt;table class="display"&gt;
&lt;tr&gt;
&lt;td class="table_head"&gt;
VIRA© Entry Confirmation-&lt;span style="font-weight:normal;font-size:9pt"&gt;Step 5 of 5&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="sub_head" style="border:thin groove silver;background-color:#dcdcdc;color:red"&gt;
If you are not automatically redirected to a secure third-party site for processing of your credit card
within 10 seconds please click this button.&lt;br /&gt;
&lt;form name="pop_up" method="post" action="&lt;%=sProdURL%&gt;" target="_blank"&gt;
&lt;input type="submit" name="submit" id="submit" value="Pay Fee" /&gt;
&lt;/form&gt;
&lt;/td&gt;
&lt;/tr&gt;


There are some small changes but nothing that I would think would affect the javascript.
Copy linkTweet thisAlerts:
@FromU2MEDec 30.2005 — I'm not sure, but maybe you're restricted from submitting a form using onload...

Did you try if the code works if you place it on a button or a text-link instead of onload?
Copy linkTweet thisAlerts:
@bobbabuoyauthorDec 30.2005 — I got it working. Seems it didn't like the name/id attribute of "submit". Once I changed those it worked well. I could do it using a "button" or a "submit" input type but if I used a "button" then I had to put a "onclick=document.forms.form1.submit()" in the tag.

Thanks for your help!
×

Success!

Help @bobbabuoy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...