4 Replies Latest reply on Jan 18, 2011 3:15 PM by Jo_2005

    Alert showing twice from document level javascript

    Jo_2005 Level 1

      Hello,

       

      I have an acro form with a document level javascript which is called from the text field custom calculation script:  AlertAction();

       

      The alert shows/repeats twice each time from the function instead of once.

       

      Can anyone please advise why this would occur??

       

      This is the document level javascript:

       

      function AlertAction()
      {
      // compute only if the start timing button has been clicked

      var j = this.getField("StopAlert1").value;
      if (j ==1) {

       

      // adjust for a 2 minute warning and alert when adjusted time is matched

      // get the string value for the agenda item duration

      var sAgendaTime = this.getField("Action Time").value;
      // only perform if there is a value for the event
      if(sAgendaTime != '') {
      // convert agenda item duration into an array with the elements for minutes and seconds with the adjusted time
      var aAgendaTime = sAgendaTime.split(":");
      var sAgendaWarning = util.printf("%02d:%02d:%02d", 0, aAgendaTime[0] - 2, aAgendaTime[1]);
      // compare to the stop watch display value
      var t = this.getField("StopWatchDisp");
      if(t.value.substr(0,8) == sAgendaWarning) app.alert("Action Agenda time up in two minutes, wrap up discussion");

      }
      }
      return;
      } AlertAction;

       

      Any assistance will be most appreciated.