aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes onLoad function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "onLoad function" Watch "onLoad function" New topic
Author

onLoad function

Brendan Martin
Greenhorn

Joined: Apr 06, 2004
Posts: 9
Hi all
I have form with all the data already completed.
I want the form to auto submit on page load
I need the form to submit every 10 seconds
Any ideas?
Thanks
Brendan
Tobias Hess
Ranch Hand

Joined: Apr 06, 2004
Posts: 55
Any ideas?
Use Javascript, and dont ask in a Java forum.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the HTML and JavaScript forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
setInterval("document.FormName.submit()",10000);
Brendan Martin
Greenhorn

Joined: Apr 06, 2004
Posts: 9
Thank you
This is working for me but i still have a problem
when i set the number to anything over 200 then it does not work
setInterval("document.myForm.submit()",200); works but submits too often
the error i am getting is:
a runtime error has occured
Line 0
object does not support this property or method
any thoughts?
Thanks
Brendan
[ April 07, 2004: Message edited by: Brendan Martin ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
the number is in milliseconds, It should work for any number.....
Brendan Martin
Greenhorn

Joined: Apr 06, 2004
Posts: 9
the error i am getting is:
a runtime error has occured
Line 0
object does not support this property or method
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
what is the exact code that you are using?
Brendan Martin
Greenhorn

Joined: Apr 06, 2004
Posts: 9
<SCRIPT LANGUAGE="JavaScript">
setInterval("document.myForm.submit()",1000);
</script>
<FORM id=myForm name=myForm action=/cgi-bin/clients/index.cgi method=post>
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
Hi,
I am not exactly know you code, but if your form submition reloads the whole page, you better use setTimeout, not setInterval.
The error that you have might happend, when the page is partially unloaded, so form is not exist anymore, but you are trying to submit it anyway.
Funny - we posted it at the same time. Yes, you better use setTimeout.
By the way, it will looks like - page loaded, after x ms form submitted, that wait until form processed, that page loaded, that after x ms form submitted - is that what you want?
[ April 07, 2004: Message edited by: Yuriy Fuksenko ]
Brendan Martin
Greenhorn

Joined: Apr 06, 2004
Posts: 9
Thank you very much Yuriy Fuksenko
I have tried setTimeout('document.myForm.submit()',10000);
and got the same problem, i.e. anything over 200 just doesn't work
I would be willing to pay or offer some free hosting for someone to fix my problem.
I need the form to submit every 3 seconds for a period of 8 hours
Thanks Brendan
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
I think, if youpost a link, where peaple could get your page source, and define some more specific requirements, you will more than one solution even for free
Brendan Martin
Greenhorn

Joined: Apr 06, 2004
Posts: 9
I cannot post the link because the form is active and sends a pgp signed email to Nominet for automatic UK domain name registration
I would post it in a private message though if anyone can hrelp
Thanks Brendan
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
Ok, sent me an email jranch@devsoftware.com
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Originally posted by Brendan Martin:
the error i am getting is:
a runtime error has occured
Line 0
object does not support this property or method

Sounds like that error is on the server side if I am correct
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
And if you have an onload function submitting the form, get rid of that...
Brendan Martin
Greenhorn

Joined: Apr 06, 2004
Posts: 9
Thank you all for your help
Yuriy sorted it via email
below was the problem
Hi, the error happends, because You have element with name=submit at the end
of a form. Just rename it to anything else like submit1 for example, and it
will solve your problem.
Also note, that element with name=reset also overrides standart function of a
form object, and I would suggest you to rename it as well.
This sorted it for me:-)
Best wishes
Brendan
 
Don't get me started about those stupid light bulbs.
 
subject: onLoad function