Page 1 of 1

Submit Form on Page Load

Posted: Tue Mar 16, 2004 2:36 am
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>

Posted: Tue Mar 16, 2004 8:39 am
by Goowe
What is the problem?

Posted: Tue Mar 16, 2004 9:06 am
by Joe
Try and explain your problem a bit better!

Re: Submit Form on Page Load

Posted: Tue Mar 16, 2004 12:08 pm
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)