Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help with Auto Session Timeout using Javascript

Zack.LJun 8 2007 — edited Jun 12 2007
Hi,

 Had created  Timeout app in apex.oracle.com
Workspace = ez
Login      = 123456
Password   = 123456
App ID     = 19765

 Basically able to timeout if no activity is detected( Key strokes when input data ) within 10 seconds,
 using the below javascript in HTML Header:

<script language="JavaScript" type="text/javascript">
<!--
var timeLength=10000 
function stopCount()
{
clearTimeout($x('P1_TIMEOUT_ID').value)
startCount()
}
function startCount()
{
$x('P1_TIMEOUT_ID').value=setTimeout( 'doLogout();', timeLength )
}
function doLogout()
{
$x('P1_TIMEOUT_ID').value=0
doSubmit('TIMEOUT');
}
//-->
</script>

and Page Item P1_TIMEOUT_ID and a branch which logout user when executing
doSubmit('TIMEOUT');
All page items under Element, HTML Form Element Attributes set to onKeyup="stopCount()"; 
( does not work for Select List, guess will not work for LOV, Check Box too )

Questions:

1. How to enable Select List, Check Box, LOV to call function stopCount() ?

2. How to detect user's activity which could be simply moving mouse, up/down arrows 
    keys or any keys outside of Apex's item like Text Field, LOV, etc ?

3. Guess to make it work, had to set P1_TIMEOUT_ID item, javascript and the branch in
Page Zero to make it accessible to all pages in application and all pages' items need to have
 HTML Form Element Attributes set to onKeyup="stopCount()";  , right ?

4. Is there more elegant way to do the above ?

 Was quite surprised no complete example was available, just piece together relevant  forum tips and lots of js reading. 

Thanks in advance

Zack 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 10 2007
Added on Jun 8 2007
6 comments
1,143 views