0

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;   
      }    
  }
Igor Milla
  • 2,767
  • 4
  • 36
  • 44
giff1
  • 101
  • 1
  • 12
  • 1
    any code would be greatly appreciated. It's hard to solve code issues without seeing any code. – Igor Milla Nov 17 '14 at 16:37
  • can you log the value of the variable `Elmt` each time you press submit button? So we know, into which `if..else` block your code goes the time when everything fails – Igor Milla Nov 17 '14 at 17:07
  • it is the SS value. I haven't tried it with the other radio buttons yet but everytime the value is SS after the third submit it breaks – giff1 Nov 17 '14 at 17:56
  • in the `for` loop of that `if` case, you don't have `var` before declaring `count`, if you are using your js in strict mode, it can be the issue. – Igor Milla Nov 17 '14 at 18:02
  • alright I will give it a try and let you know. – giff1 Nov 17 '14 at 18:08
  • @igormilla So I tried that and it is still having the issues – giff1 Nov 17 '14 at 18:12
  • and do you have any errors in the javascript console? – Igor Milla Nov 17 '14 at 18:14
  • There aren't any errors – giff1 Nov 17 '14 at 18:15
  • Then you should put breakpoints and debug, to find exact line of code that breaks your page. You can do it in chrome dev tools or in firebug – Igor Milla Nov 17 '14 at 18:20
  • You should be using the Prompt API to select and manipulate the prompts in the page. I would recommend getting the Prompt API samples which are included with the SDK for Cognos and following them as a guide. Typically code which uses proprietary methods and objects(the ones that start with underscores) are more prone to having problems. Even if that weren't the problem, IBM support wouldn't be assisting you unless you were using the Prompt API anyways – Abe Fehr Nov 18 '14 at 04:34

0 Answers0