Solved

JSP submitting after a certain time

Posted on 2004-09-25
3
283 Views
Last Modified: 2010-04-01
Hi Experts,

May I ask how to submit a page without clicking a button or whatsoever...   just time controlled if possible...

A sample code would be best...


Thanks in advanced experts...!    =)
0
Comment
Question by:aris_datuin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
lhankins earned 60 total points
ID: 12150852
just use some javascript with the setTimeout function, for example, the following will cause the form to be submitted 3 seconds after the page has fully loaded (this is setup in the initUi() method which is called by the document.onload handler). :


--------------------------------------
<html>
<head>

<script type="text/javascript">

function doSubmit()
{
   alert("submitting form");
   document.forms[0].submit();
}

function initUi()
{
   setTimeout("doSubmit();", 3000);
}

</script>
</head>

<body onload="initUi()">
   <form action="/actions/doSomething">

      <input type="text" value="some value"/>
   </form>
</body>

</html>


0
 
LVL 21

Expert Comment

by:MogalManic
ID: 12150860
The short answer...You cant.

Here are some options though..
   -You could set the page to refresh to a new URL after N seconds
   -You could setup an event handler on mousemove, keydown, etc.  and implement a timer there
    eg.  
     var pageStart=new Date()
     function onMouseMove()
     {
        var now=new Date();
        var delta=now.getTime()-pageStart.getTime()
        if (delta>60000)
           form.submit();
     }
0
 
LVL 21

Expert Comment

by:MogalManic
ID: 12150862
sorry, forgot about the setTimeout.  That would work too
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question