• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onLoad function

 
Brendan Martin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any ideas?
Use Javascript, and dont ask in a Java forum.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the HTML and JavaScript forum...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setInterval("document.FormName.submit()",10000);
 
Brendan Martin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the number is in milliseconds, It should work for any number.....
 
Brendan Martin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the exact code that you are using?
 
Brendan Martin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, sent me an email jranch@devsoftware.com
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And if you have an onload function submitting the form, get rid of that...
 
Brendan Martin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic