Jump to content
rizwansyed

text not submitting

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

Share this post


Link to post
Share on other sites

You need a name attribute value, NO value means there won't be any identifier to retrieve the value. All form inputs, submit, textarea, select etc require name attribute value

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...