• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Across JSPs wrong JavaScript Function with the same prototype is getting called

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There !

Use Case Description:
------------------------
I have a report as JSP and in this JSP I have one "Select Job" button and few dropdowns into the "Filter" section of this report.

When user clicks on "Select Job" button a popup window of "Job List" opens from where user can filter desired "Job" over which he/she wants to generate report.

Problem Description:
-----------------------
In order to capture selected filters I have defined Javascript function: "captureDropDownSelectedValues(filters)" not only in report JSP but also in "Job List" JSP which appears in popup window .

Please note that the name and prototype of "captureDropDownSelectedValues(filters)" is same in both JSPs.

Now issue here is that when I click "Select Job" button in report JSP & configures filters there then it shows me "Job List" JSP perfectly fine and captures filters properly but the same is not happening in report JSP...I mean when I set filters in report JSP and click "Generate Report" then in order to capture report filter values I am expecting that browser should call report's "captureDropDownSelectedValues(filters)" function whereas browser is calling "captureDropDownSelectedValues(filters)" function of "Job List" JSP page...I verified this in "Firebug".

Any idea why is so?

Gajendra
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your problem description could use code since the words do not paint a clear picture.

Eric
 
Gajendra Tomer
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Code may complicate the issue description...ok let me rephrase it in a simplified way.

Say we have 2 JSPs...JSP1 & JSP2 and having identical javascript functions with identical code...say the name of that function is "function1()".

Now what's happening that when we call "function1()" of both JSPs one after another then IE8 get goofed up and call "function1()" of JSP1 instead of JSP2.

Tomar

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What leads you to believe that? Only one page is loaded at a time, unless you have frames or a frameset.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gajendra Tomer wrote:Now what's happening that when we call "function1()" of both JSPs one after another then IE8 get goofed up and call "function1()" of JSP1 instead of JSP2.



And the code of both functions is identical, so I don't see why that's a problem or how you could even notice it.
 
Gajendra Tomer
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul & Bear!

I noticed this(that the wrong function is getting called) while debugging javascript code in "Firebug".

When I changed the name of those identical functions then it started working fine.

Code for your reference:
-------------------------


SNIPPET1:

JSP1(having identical function:"function1()") is having following snippet:
--------------------------------------

Note that function:"selectSomethingID();" mentioned above invokes JSP2(having identical function:"function1()").

Also, JSP1 is having following code snippet from where it invokes "function1()":


SNIPPET2:



So, what happens if we click button 1st which is given in SNIPPET1 then it invokes function:"function1()" of JSP2...that's ok....but just after that....if panel(refer SNIPPET2) invokes function:"function1()" of JSP1 then it doesn't get invoked rather function:"function1()" of JSP2 is invoked.

This I noticed in Firebug.

I hope now you will be clear with the problem scenario.

Gajendra

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic