My Javascript function breaks my cognos report after I hit submit 3 times

485 views Asked by At

I have some HTML buttons that I created that bring up different value prompts and to the right of them is a submit button. Everything works great the first few times. But everytime on the third time I push the submit button, everything goes white, the report re-loads, and my value prompts are moved to the bottom of the report. I have other reports that use JavaScript and after a certain amount of times of pushing the submit button the reports goes white reloads and thigns don't work. I was wondering if anyone knew why Cognos does this. I am using 10.2.1 report studio. Any help would be greatly appreciated.

    var ftw = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
    var button = ftw._textEditBoxbuttonBox.value;

    skillGroupButtons(button);

    function skillGroupButtons(Elmt){

      var firstPrompt = ftw._oLstChoicesfirsttPrompt; 
      var secondPrompt = ftw._oLstChoicessecondPrompt; 
      var SS = ftw._oLstChoicesSSPrompt; 

      ftw._textEditBoxbuttonBox.value = Elmt;

      if (ftw._textEditBoxbuttonBox.value  == "first"){
        document.getElementById('first').style.visibility = "visible";
        document.getElementById('second').style.visibility = "hidden";
        document.getElementById('SS').style.visibility = "hidden";    
        document.getElementById('first').checked = true;

        SS.options[0].selected = true;    
        second.options[0].selected = true;

        for (var count=1;count <second.length; count++){
          second.options[count].selected= false;
         }
      } else if ( ftw._textEditBoxbuttonBox.value== "SS"){
        document.getElementById('first').style.visibility = "hidden";
        document.getElementById('SS').style.visibility = "visible";
        document.getElementById('second').style.visibility = "hidden";    
        document.getElementById('SS').checked=true;    

        first.options[0].selected=true;    
        second.options[0].selected=true;

        for (count=1;count <second.length; count++){
          second.options[count].selected= false;
        }
      } else {
        document.getElementById('first').style.visibility = "hidden";
        document.getElementById('SS').style.visibility = "hidden";
        document.getElementById('second').style.visibility = "visible";    
        document.getElementById('second').checked = true;

        first.options[0].selected = true;
        SS.options[0].selected = true;   
      }    
  }
0

There are 0 answers