Submit Form on Page Load

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
phppick
Forum Commoner
Posts: 57
Joined: Thu Aug 14, 2003 5:59 am

Submit Form on Page Load

Post by phppick »

Hi,

I have Code like this

Code: Select all

<body onLoad="document.all.frm.submit()">
	<form name="frm" method="post" action="http://127.0.0.1/folder/call.php" onSubmit="calljs()">
	<input type="hidden" name="name" value="<?php print("AA");?>">
	<input type="hidden" name="ID" value="10">
	<input type="hidden" name="Subject" value="<?php print("CM");?>">
	<input type="hidden" name="interface" value="ie">
	</form>
</body>
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

What is the problem?
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Try and explain your problem a bit better!
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: Submit Form on Page Load

Post by TheBentinel.com »

phppick wrote: <body onLoad="document.all.frm.submit()">
<form name="frm" method="post" action="http://127.0.0.1/folder/call.php" onSubmit="calljs()">
If I'm not mistaken, the onSubmit code isn't fired when you submit via javascript. It's only fired when a user submits the form.

You can simulate it, though, but changing your onLoad to:

onLoad="calljs(); document.all.frm.submit();"

Or put both commands in a function and call the function.

Hope it helps! (If that's what you were asking about)
Post Reply