Jump to content

automatically submitting on time-out


This topic is 8488 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a database which operates as a test. I want to put an automatic time limit of 80 minutes on it. I can obviously do this with javascript, but how could I get it to automatically submit an -edit command upon the 80 minutes? I can't really do it with a URL link instead, because of the variability of the field entries. Any ideas?

Link to comment
Share on other sites

well you would put this between the head (<head></head> ) commands on you document

code:


<script language="javascript'>

<!---//

function sendit(){

alert("Your 80 minutes are up, this form will now be submitted")

document.forms[0].submit()

}

//--->

</script>


then put this in you body tag..

code:


<body 0nL0ad="setTimeout('sendit()',4800000)">


make sure you change the zero in 0nL0ad to the letter "o". couldn't submit the form with and onload tag in it.. which is a pain in the butt.

that should do it.. this is all assuming that the form is all on one page.

if the form spans many many HTML pages this is going to be much much harder to do..

[ April 04, 2001: Message edited by: bman ]

Link to comment
Share on other sites

  • 2 weeks later...

hm. it's not working. here's my code:

<HEAD>

<TITLE>Coaches Certification Test</TITLE>

<META NAME=GENERATOR CONTENT="Claris Home Page 3.0">

<X-CLARIS-WINDOW TOP=56 BOTTOM=607 LEFT=14 RIGHT=813>

<X-CLARIS-TAGVIEW MODE=minimal>

<script language="javascript'>

<!---//

function sendit(){

alert("Your 80 minutes are up, this form will now be submitted")

document.forms[0].submit()

}

//---></script>

</HEAD>

<BODY BGCOLOR="#FFF3D9" onl0ad="setTimeout('sendit()',60)">

the only thing i changed above is the "0" instead of the "o" in onload. hmm

Link to comment
Share on other sites

what doesn't work.. does it just not submit.. or does it submit to soon. because you have a 60 in the set time out.. that should be a lot more than 60, settimeout is done it milisecond..so for 1 minute you 60000 so you 80 minutes you would need 4800000, as my original post said. so it should say

setTimeout('sendit()',4800000)

If thats not the problem than post again with a little more detail about the problem.

Link to comment
Share on other sites

Okay. Part of the problem was in the syntax, where I had typed "javascript' instead of "javascript" Luckily I still use claris home page so i could tell that the script wasn't "active" by the highlighting. Now, it does the auto-submit, but then i get an error 4 (unknown command) that doesn't occur if i manually submit it, it works fine. i'm not so good on javascript, so if you could help me figure out the offending command, i'd be very grateful! i'm psyched it's working this well already.

thanks

bevin

Link to comment
Share on other sites

hmmm...

well normally you would submit with a submit button so you would have code that looked similar to this

<input type="submit" name="-new" value="submit">

or something similar, correct?

well since you are not submitting it with that button you need to find another way of putting that -new in there somewhere. so just go ahead and put this code right near the submit button, probably just before it.

<input type="hidden" name="-new">

that might fix it.. if you have already done that then i'm not sure what the problem will be...

oh and sorry about putting the wrong quotes around javascript.. just looked at my first post and that was my fault.. guess i was typing it in a hurry. laugh.gif" border="0

[ April 16, 2001: Message edited by: bman ]

Link to comment
Share on other sites

This topic is 8488 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.