How can I get a form to submit automatically?

Results 1 to 4 of 4

Thread: How can I get a form to submit automatically?

  1. #1
    Join Date
    Dec 1969

    Default How can I get a form to submit automatically?

    I want to be able to collect data from a form after a timed period without the user necessarily having to hit a submit button.<BR>Any ideas please?

  2. #2
    aa Guest

    Default RE: How can I get a form to submit automatically?

    surely you could use the system clock attahced to a variable somehow.

  3. #3
    Join Date
    Dec 1969

    Default in vbscript....

    in the window_onload event use the setInterval window method to call a function at specified time intervals. the function this calls could then execute the submit method of the form. then, in the window_onunload event make sure you use the clearInterval window method passing it the value returned from the setInterval method.<BR><BR>hope this helps.

  4. #4
    Join Date
    Dec 1969

    Default Yuck, Yuck, Yuck!!!

    System clock attached to a variable?<BR><BR>VBScript, client-side?<BR><BR>Come on guys...<BR><BR>There&#039;s an easy way to do it, and I guess that coding it in VBScript IS POSSIBLE. It&#039;s just not the best way to do it at all.<BR><BR>Only Microsoft IE supports VBScript, so coding in it will not exactly win you any cross-browser-compatibility awards. The simplest way is to use JavaScript. If you don&#039;t know JavaScript, it&#039;s a very simple language with a syntax much like Java (it&#039;s not like VB and VBScript, however).<BR><BR>==== START<BR>&#060;script language="JavaScript"&#062;<BR>// Call funcToCall() after 5000ms (5 secs)<BR>var x = setTimeout("funcToCall()", 5000);<BR><BR>function funcToCall(){<BR> // Stop the timeout variable - good coding technique;<BR> clearTimeout(x);<BR> // Submit the form - JavaScript 1.1 upwards (v3 browsers)<BR> document.formname.submit();<BR>}<BR>&#060;/script&#062;<BR>==== END<BR><BR>Remember, if you&#039;re using a Microsoft server, ASP (VBScript) server-side and JavaScript client-side. Unix/Linux/derivative, CGI/ASP server-side and JavaScript client-side.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts