Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript Scoping Issue or Instantiation Issue?
    primarykey
    data
    text
    <p>I have a webpage that does some calculations on the fly based on user 'keyup' events in a text input field. It's a rather large page that is built dynamically, so I have to keep a Hash/Array of values that I can reference from other locations within the page.</p> <p>So at the top of the page I am doing this -</p> <pre><code>var itemBalanceHash = new Array(); var itemID_2_POIDHash = new Array(); var currentPODocumentID; var warningArray = new Array(); </code></pre> <p>Then I go on to define a number of functions that use these variables I just defined. However, it is not until after I finish defining these functions that these variables start getting used (i.e. filled with stuff.)</p> <pre><code>&lt;script type="text/javascript"&gt; itemBalanceHash["${topitem.itemIdentifier}"]="${topitem.itemOutstandingEncumberedAmount}"; itemID_2_POIDHash["${topitem.itemIdentifier}"] = currentPODocumentID; &lt;/script&gt; </code></pre> <p>This script block appears in the middle of my page as it is getting built. In fact, it gets called multiple times depending on how many rows I need to fill (a result set of a query from the database).</p> <p>Anyhow - This works great in Firefox. However, it does not work in IE8, Chrome or Safari. I haven't tested this in older versions of IE; but I assume it will not work there either.</p> <p>The error message Internet Explorer Debugger is giving me is this</p> <p>"itemBalanceHash is undefined"</p> <p>So, my question: Is this a scoping issue?<br> Firefox seems to have corrected my error somewhere, but where?</p> <p>I can provide more code if necessary. Thanks for your help!<br> It is most appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload