I am trying to submit a form using javascript . But its always error out as "Cannot call method submit of undefined " i crosschecked on the name on the form but it didnot worked , I wrote one sample HTML to just check if this approach works and it was working fine . Please help me out on this .
my JSP :
<div id="Symptoms" style="display:none;">
<html:form id="ashutosh" method="POST" action="symptoms" >
<p></p>
<p>Enter/Choose ailment :
<html:select id="diselc" name="AuthoringForm" property="disease_name" size="1" onchange="javascript:formsubmit(this.formName);" >
<option selected="selected"> </option>
<option>Malaria</option>
<option>High Fever</option>
<option>Cholera</option>
<option>Diarrhoea</option>
</html:select></p>
<p>Choose ailment classification :
<html:select id="diselchild" name="AuthoringForm" property="diesclassifiaction" >
<option>High</option>
<option>Medium</option>
<option>Low</option>
</html:select>
<fieldset style="width: 381px; height: 126px; padding: 2">
<legend align="left"></legend>
Tick off patient context :
<html:radio value="Men" name="AuthoringForm" property="patient_context" disabled="false"/>
Men
<html:radio value="Womwen" name="AuthoringForm" property="patient_context" disabled="false"/>
Women
<p>
<html:radio value="Child" name="AuthoringForm" property="patient_context" disabled="false"/>
Child
<html:radio value="Al" name="AuthoringForm" property="patient_context" disabled="false"/>
All
</fieldset>
<p>Enter Pre Conditions</p>
<p><html:textarea rows="2" name="AuthoringForm" cols="20" property="patient_precondition" ></html:textarea>
<p>Must Have Symptoms :
May Have Symptoms :</p>
<p><html:textarea rows="2" name="AuthoringForm" cols="20" property="must_have_symptoms"></html:textarea>
<!-- <input type="submit" value="Submit" name="B2">-->
<html:textarea rows="2" name="AuthoringForm" cols="20" property="may_have_symptoms"></html:textarea>
<input type="submit" value="Submit" name="symptomsButton"><input type="reset" value="Reset" onclick="clear_form_elements(this.form);"></p>
</html:form>
</div>
my javascript :
function formsubmit(value){
alert("i am just above the form submission"+value);
document.forms["ashutosh"].submit();
alert("i am just after the form submission");
}