Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JSP submitting after a certain time

Posted on 2004-09-25
3
Medium Priority
?
285 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 240 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Files go missing when using DFS (Distributed File System) Replication and how to recover them and fix it.
Check out what's been happening in the Experts Exchange community.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 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