PDA

Click to See Complete Forum and Search --> : Sumbit a Form


kurtsimons
Aug 9th, 2000, 09:46 AM
is there a way via java script to force a form to be posted back to the server...


document.FormData.submit


thanks
kurt

Aug 9th, 2000, 10:31 AM
The webpage must have an "onunload" event (or something similar) that fires when the window is closed or another page is loaded. Can't you use that?

I assume it would be something like:

<body onunload="javascript:somefunction()">

The only reason I know this event must exist is because alot of Warez sites doit. You know...when you close one crap popup window another 5 appear?

kurtsimons
Aug 9th, 2000, 12:37 PM
thats now what I am trying to do...

lets say we have a form on a page that is waiting for a user to click submit. Well lets say his mouse moves over a picture (that is not part of the form) I want the submit button to automatically get clicked

Mage33
Aug 9th, 2000, 03:54 PM
Yeah, that's what I was recommending to him as well, except it's document.form1.submit1.click

Aug 9th, 2000, 06:17 PM
Stop bitchin about wether it's formname.submit or formname.submitbutton.click...

I've had both of them working although I feel that you may as well use the one that requires the least coding.

A lazy programmer is a good programmer.

Here's a WORKING example:
<html>
<head>
<title>MRHP: Open Diary Loader</title>
</head>
<body onload="javascript:loginform.submit()" bgcolor="#FFFFFF" text="#000000" link="#800080" vlink="#008000" alink="#FFFF00">
<form name="loginform" action="http://www.opendiary.com/express.asp" method="post">
<input type="hidden" name="logstring" value="... dreams ...">
<input type="hidden" name="logpw" value="*******">
<input type="hidden" name="localpage" value="/entrylist.asp?authorcode=A182232">
</form>
<font face="Arial, Helvetica, sans-serif">
Open Diary is loading...please wait.
</font>
</body>
</html>

Usually you wouldn't make all the <input> tags hidden tho. :)

Mage33
Aug 9th, 2000, 06:47 PM
Heh, good point, I just didn't know if the way he had come up with worked and I'm at work so I didn't really want to spend the time to test it :).

kurtsimons
Aug 10th, 2000, 05:45 AM
Thanks a ton