Jump to content

text not submitting


rizwansyed

Recommended Posts

Hi

I have a codeĀ  where am using a select drop down and for 5th variable a text box will be opened and need to enter the value.

But the entered value is not submitting at the server .

 <form action="/COHARToutputsimulation" id="chout" method="post" target="formDestination">

                        <font size="5"> <strong>Output Simulation-HART:
</font></strong>
<select name="selected" onchange="cooutsim(this.value)">
  <option value="0"> Simulate - 4 mA</option>
  <option value="1">Simulate - 8 mA</option>
  <option value="2">Simulate - 12 mA</option>
  <option value="3">Simulate - 16 mA</option>
  <option value="4">Simulate - 20 mA</option>
  <option value="5">Simulate value </option>
</select>
   
<input type="text" id="ousi" size="10px" style="display:none;">
&emsp;
<input type="submit" style="font-size:10pt;" onclick="chrtout(event)">
</form>
<script>
function cooutsim(val)
{
	if(val == 5)
	{
		document.getElementById("ousi").style.display="inline";
	}
	else
	{
		document.getElementById("ousi").style.display="none";
	}
}
function chrtout(event) {
   var myForm  = document.getElementById('chout');
   event.preventDefault();
   formData = new FormData(myForm);
     var xhttp = new XMLHttpRequest();
     xhttp.onreadystatechange = function() {
       if (this.readyState == 4 && this.status == 200) {
         document.getElementById("chout").innerHTML =this.responseText;
       }
     };

     xhttp.open("POST", "COHARToutputsimulation",true);
     xhttp.send(formData);
     return true;

   }
</script>

What is the issue am not getting.

Please suggest

Thanks and Regards

Rizwan Syed

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...