Problems with popup calendar after adding extra Javascript

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

Problems with popup calendar after adding extra Javascript

#1

Postby Vircos » Tue Oct 23, 2007 9:19 am

I am not sure where to put this question.
I have added some custom javascript to a Ebase form to display a session time-out timer.
Since then the Ebase popup calendar (part of date field) won't work.

I think setting the innerHTML part is causing the problem. If I remove that part the pop calendar works fine again but it makes my custom script useless. I can't find any solution for it. Does anyone has a suggestion what the problem might be?

Code: Select all

/**
*  Script: sessionTimer.js
*  Date: 23-10-2007
*  Author: Remco Visser
*/

// +++ Config +++ //
var sessionTimeOut = 30; //minuten

// +++ Globals +++ //
var seconden = 60;
var minuten = sessionTimeOut;

// +++ Functions +++ //
function init() {
  sessionTimer();
}

function sessionTimer() {
    if(minuten == sessionTimeOut)
               minuten--;

    if(seconden == 0) {
      seconden = 60;
      minuten--;
    }
    
    seconden--;

    if(minuten == 0 && seconden == 0) {
      var timer = "0:00";
      document.getElementById("sessionTimer").innerHTML = timer;
    } else {
      if&#40;seconden < 10&#41; &#123;
        var timer = minuten + "&#58;0" + seconden;
      &#125; else &#123;
        var timer = minuten + "&#58;" + seconden;
      &#125;
      document.getElementById&#40;"sessionTimer"&#41;.innerHTML = timer;
      setTimeout&#40;"sessionTimer&#40;&#41;", 1000&#41;;
    &#125;
&#125;
0 x
What's the meaning of Justice...

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

#2

Postby Vircos » Wed Oct 24, 2007 11:06 am

I do have the solution. It is not the innerHTML part causing a problem.

The function init() overwrites the init() function in the calendar javascript file.

Also using window.onload or <body onload="init();"> will overwrite the standard Ebase javascript functions.

The solution is adding the javascript functions to the existing <body onload="";> tag.

This can be done by placing the following code in the HTML++ part in the form properties.

Code: Select all

// Loading custom Javascript file
<script language="JavaScript" type="text/JavaScript" src="myfunctions.js"></script>

// Adding custom functions to the onload event
<script language="JavaScript" type="text/javascript">
// IE
if &#40;window.attachEvent&#41; &#123;
window.attachEvent&#40;'onload', MyFunction&#41;;
&#125;
// Firefox
else if &#40;window.addEventListener&#41; &#123;
window.addEventListener&#40;"load", MyFunction, false&#41;;
&#125;
</script>
0 x
What's the meaning of Justice...

selbjx
Ebase User
Posts: 22
Joined: Fri Jun 06, 2008 8:35 am

#3

Postby selbjx » Fri Jun 06, 2008 9:23 am

I have something very similar to this. I find putting it either as suggested in the html++ or you could include it in your surround files (border files, left, right, bottom, top etc) which worked for me.
0 x


Who is online

Users browsing this forum: No registered users and 32 guests