title: Reading form field data in Javascript
body: <p>I just can't get this to work. </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form action="index.php?page=n0402" method="post" Name="AddPolish" &gt;
      &lt;div id="frmBrandInput"&gt;
          &lt;label for="frmBrand"&gt;Brand name:&lt;/label&gt;
          &lt;input type="text" name="frmBrand" size="50" onkeypress="BrandCheck();" maxlength="100" id="frmBrand" value="Enter existing or new brand"  /&gt;
          &lt;span id="frmBrand_Status"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function BrandCheck()
  {
      var jsBrandName = document.forms["AddPolish"]["frmBrand"].value;
      alert(jsBrandName);
  }
  </code></pre>
  
  <p>Why can't I get the value of frmBrand into jsBrandName? If I use Firebug to debug, I get the following in my Watch list:
  Watch Expression:</p>
  
  <pre><code>document.forms["AddPolish"]["frmBrand"];
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>NodeList[input#frmBrand property value = "G" attribute value = "Enter existing or new brand", input#frmBrand attribute value = ""]
  </code></pre>
  
  <p>I can see the value "G" which is what I entered in the input field. What am I doing wrong in passing it into the jsBrandName?</p>