-1

In Cognos 8.4, I have a prompt, "NAME", and its parameter p_name.

How do I get that parameter through JavaScript?

<script>
    alert(p_name)
</script>

shows a JavaScript error. Why?

Is my approach correct?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
shanmugam
  • 143
  • 1
  • 4
  • 14

2 Answers2

2

Maybe the reference for the object will be missing, and you have to keep up with the scope of the variables or the parameters. You can use the "Developer Tools" in Internet Explorer 8 by pressing "f12". There in the right hand side pan you can choose the tab "console" to find where you went wrong or you can choose the tab "locals" to find whether the parameter has any values in the scope where you are calling it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
AmGates
  • 2,127
  • 16
  • 29
  • But Still how could this help me in cognos? I guess you are giving me solution regd purely Javascript? do you have any idea related to cognos as well? – shanmugam Aug 23 '11 at 07:17
  • As you sair i checked in locals. By default its empty? Do i need to click any to find specific paramenter? – shanmugam Aug 23 '11 at 07:25
  • Please can u paste the actual part of the code u r trying to work on? But i don't know cognos. This is a javascript part so I think I can help u out – AmGates Aug 23 '11 at 08:00
0

I don't know Cognos, but your problem is that you are calling a variable that is local to an object in the global scope. You have to do whatEverTheObjectIsCalled.p_name (probably). An easy way to find out exactly what you are looking for is to fire up the web page in Chrome and console.log(theObject) and browse through the internals of the object until you find the attribute you want.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tegra Detra
  • 24,551
  • 17
  • 53
  • 78
  • Thanks for your reply James. Sorry we dont have access to chrome in office. Do you have any thing similar to console.log(theObject) in Internet Exlporer 8? – shanmugam Aug 23 '11 at 06:27