title: value pass from html dropdown to javascript
body: <p>i am trying to pass value from jsp to javascript but it crashes saying value is undefined </p>
  
  <p>my dropdown code :</p>
  
  <pre><code>&lt;html:select  name="AuthoringForm" property="disease_name" size="1" onchange="javascript:onchange_action()" &gt;
  &lt;option selected="selected"&gt; &lt;/option&gt; 
  &lt;option value="Malaria"&gt;Malaria&lt;/option&gt;
  &lt;option value="High Fever"&gt;High Fever&lt;/option&gt;
  &lt;option value="Cholera"&gt;Cholera&lt;/option&gt;
  &lt;/html:select&gt;&lt;/p&gt;
  </code></pre>
  
  <p>javasript :</p>
  
  <pre><code>function onchange_action()
  {
      var e=document.getElementsByName("AuthoringForm");
      alert("the value of the option here is "+e);
      decisiontree.dieasenameencode=e;
  }
  </code></pre>
  
  <p>alert says :</p>
  
  <pre><code>the value of the option here is undifined 
  </code></pre>
  
  <p>my jsp :</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&gt;
  &lt;%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&gt; 
  &lt;%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %&gt; 
  &lt;%@taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %&gt; 
  &lt;% 
  response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
  response.setHeader("Pragma","no-cache"); //HTTP 1.0
  response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
  %&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="javascript/display_toggle.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="javascript/onchange_action.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;IDOC AUTHORING TOOL&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p&gt;
  &lt;u&gt; &lt;/u&gt;&lt;font size="7"&gt;&lt;u&gt;IDOC AUTHORING TOOL&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;p&gt;Choose Authoring Mode :
  &lt;select size="1" name="AuthoringOption" id="AuthoringOption" onchange="javascript:display_toggle()"&gt;
  &lt;option selected="selected"&gt; &lt;/option&gt;
  &lt;option value ="1"&gt;Input Desicion Tree&lt;/option&gt;
  &lt;option value ="2"&gt;Input Prevention&lt;/option&gt;
  &lt;option value ="3"&gt;Input Symptoms&lt;/option&gt;
  &lt;option value ="4"&gt;Input Prescription&lt;/option&gt;
  &lt;/select&gt;
  &lt;/p&gt;
  
  
  
  &lt;div id="BasePage"  style="display:block;" &gt;
  &lt;p&gt;Enter/Choose ailment : 
  &lt;select  size="1"&gt;
  &lt;option&gt;Malaria&lt;/option&gt;
  &lt;option&gt;High Fever&lt;/option&gt;
  &lt;option&gt;Cholera&lt;/option&gt;
  &lt;/select&gt;&lt;/p&gt;
  
  &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
      &lt;legend align="left"&gt;&lt;/legend&gt;
   Tick off patient context :
      &lt;input type="radio" value="V1" checked name="R1"&gt;Men
      &lt;input type="radio" name="R1" value="V2"&gt;Women
      &lt;p&gt;
      &lt;input type="radio" name="R1" value="V3"&gt; Child
      &lt;input type="radio" name="R1" value="V4"&gt; All&lt;/p&gt;
      &lt;/fieldset&gt;
  &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
  &lt;p&gt;&lt;textarea rows="2" cols="20"&gt;&lt;/textarea&gt; 
  &lt;/div&gt; 
  
  
  &lt;!-- ______________________________________________________________________________________________________- --&gt;
  
  
  &lt;div id="Symptoms" style="display:none;"&gt;
  &lt;html:form method="POST" action="symptoms"  &gt;
  &lt;!-- --- --&gt;    
  &lt;p&gt;&lt;/p&gt;
  &lt;p&gt;Enter/Choose ailment : 
  &lt;html:select name="AuthoringForm" property="disease_name" size="1"&gt;
  &lt;option&gt;Malaria&lt;/option&gt;
  &lt;option&gt;High Fever&lt;/option&gt;
  &lt;option&gt;Cholera&lt;/option&gt;
  &lt;/html:select&gt;&lt;/p&gt;
  &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
  &lt;legend align="left"&gt;&lt;/legend&gt;
   Tick off patient context :
  &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
  Men
  &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
  Women
  &lt;p&gt;
  &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
  Child
  &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
  All
  &lt;/fieldset&gt;
  &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
  &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;
  
  
  &lt;!-- ---------- --&gt;
  
  &lt;p&gt;Must Have Symptoms : 
  May Have Symptoms :&lt;/p&gt;
  &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="must_have_symptoms"&gt;&lt;/html:textarea&gt;
  &lt;!-- &lt;input type="submit" value="Submit" name="B2"&gt;--&gt;
  &lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="may_have_symptoms"&gt;&lt;/html:textarea&gt;
  &lt;input type="submit" value="Submit" name="symptomsButton"&gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;&lt;/p&gt;
  &lt;/html:form&gt;
  &lt;/div&gt;
  
  &lt;!--___________________________________________________________________________________________ --&gt;
  &lt;div id="Prevention" style="display:none;"&gt;
  &lt;html:form  method="POST" action="prevention"  &gt;
  
  &lt;!-- ---------------------------------- --&gt; 
  &lt;p&gt;&lt;/p&gt;
  &lt;p&gt;Enter/Choose ailment :
  
  &lt;html:select name="AuthoringForm" property="disease_name" size="1"&gt;
  &lt;option&gt;Malaria&lt;/option&gt;
  &lt;option&gt;High Fever&lt;/option&gt;
  &lt;option&gt;Cholera&lt;/option&gt;
  &lt;/html:select&gt;&lt;/p&gt;
  
  
  
      &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
      &lt;legend align="left"&gt;&lt;/legend&gt;
       Tick off patient context :
      &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Men
      &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Women
      &lt;p&gt;
      &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Child
      &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      All
      &lt;/fieldset&gt;
  
  &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
  
      &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;
  
  
  &lt;!-- --------------------------------------------------- --&gt;   
  
  
      &lt;p&gt;Input for Prevention :
      &lt;/p&gt;
      &lt;p&gt;&lt;html:textarea rows="8" name="AuthoringForm" cols="79" property="prevention"&gt;&lt;/html:textarea&gt;
      &lt;input type="submit" value="Submit" name="preventionButton"&gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;
      &lt;/p&gt;
  &lt;/html:form&gt;
  &lt;/div&gt;
  
  
  &lt;!--____________________________________________________________________________________________ --&gt;
  
  
  
  
  &lt;div id="decisiontree" style="display:none;"&gt;
  
  &lt;html:form method="POST" action="decisiontree" &gt;
  &lt;!-- ------------------------------------------------ --&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;p&gt;Enter/Choose ailment :
  
  &lt;!-- ------------------------------------ --&gt;
  &lt;html:select  name="AuthoringForm" property="disease_name" size="1" onchange="javascript:onchange_action()" &gt;
  &lt;option value="Malaria"&gt;Malaria&lt;/option&gt;
  &lt;option value="High Fever"&gt;High Fever&lt;/option&gt;
  &lt;option value="Cholera"&gt;Cholera&lt;/option&gt;
  &lt;/html:select&gt;&lt;/p&gt;
  
  &lt;!-- --------------------------------- --&gt;
  
  &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
      &lt;legend align="left"&gt;&lt;/legend&gt;
       Tick off patient context :
      &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Men
      &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Women
      &lt;p&gt;
      &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Child
      &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      All
  &lt;/fieldset&gt;
  &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
  &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;
  
  &lt;!-- ------------------------------------------------ --&gt;
  
      &lt;p&gt;
      &lt;/p&gt;
      &lt;fieldset style="width: 1225px; height: 451px; padding: 2"&gt;
      &lt;legend&gt;Decision Tree Preview &lt;/legend&gt;
  
  &lt;applet id="decisiontree" code="com.vaannila.utility.dynamicTreeApplet.class" archive="./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width ="1000" height="500" &gt;
  &lt;/applet&gt;
  &lt;/fieldset&gt;&lt;p&gt;
  
      &lt;/p&gt;
      &lt;p&gt;Enter Follow Up Questions :&lt;/p&gt;
  
      &lt;html:textarea rows="4" name="AuthoringForm" cols="45" property="follow_up_questions" &gt;&lt;/html:textarea&gt;
      &lt;html:radio value="Yes" name="AuthoringForm" property="followupconsent" disabled="false"/&gt; 
  Yes
      &lt;html:radio  value="No" name="AuthoringForm" property="followupconsent" disabled="false"/&gt; 
  No
      &lt;input type="submit" value="Submit" name="followupQuestionButton"&gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;&lt;p&gt;
      &lt;/p&gt;
  &lt;/html:form&gt;
  &lt;/div&gt;
  &lt;!--  ______________________________________________________________________________________________________________________________--&gt;
  
  &lt;div id="Prescription" style="display:none;"&gt;
  &lt;html:form  method="POST" action="prescription"  &gt;
  
  &lt;!-- ---------------------------------- --&gt; 
  
  &lt;p&gt;&lt;/p&gt;
  &lt;p&gt;Enter/Choose ailment :
  &lt;html:select name="AuthoringForm" property="disease_name" size="1"&gt;
  &lt;option&gt;Malaria&lt;/option&gt;
  &lt;option&gt;High Fever&lt;/option&gt;
  &lt;option&gt;Cholera&lt;/option&gt;
  &lt;/html:select&gt;&lt;/p&gt;
  
  
      &lt;fieldset style="width: 381px; height: 126px; padding: 2"&gt;
      &lt;legend align="left"&gt;&lt;/legend&gt;
       Tick off patient context :
      &lt;html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Men
      &lt;html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Women
      &lt;p&gt;
      &lt;html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      Child
      &lt;html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/&gt;
      All
      &lt;/fieldset&gt;
  
  &lt;p&gt;Enter Pre Conditions&lt;/p&gt;
  
      &lt;p&gt;&lt;html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" &gt;&lt;/html:textarea&gt;
  
  
  &lt;!-- --------------------------------------------------- --&gt;   
  
  
      &lt;p&gt;Input for Prescription :
      &lt;/p&gt;
      &lt;p&gt;&lt;html:textarea rows="8" name="AuthoringForm" cols="79" property="prescrption"&gt;&lt;/html:textarea&gt;
      &lt;input type="submit" value="Submit" name="prescriptionButton" &gt;&lt;input type="reset" value="Reset" onclick="this.form.reset()"&gt;
      &lt;/p&gt;
  &lt;/html:form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>