Disabled values are not submitted on form submit in a select box.
Disabled attributes properties:
Disabled controls do not receive focus.
Disabled controls are skipped in tabbing navigation.
Disabled controls cannot be successfully posted.
Disabled controls do not receive focus.
Disabled controls are skipped in tabbing navigation.
Disabled controls cannot be successfully posted.
There are two ways to submit the disabled value:
1) We disable a value so that user cannot change it, so we can delete
all other values of the dropdown keeping the required value.
2) Using a hdden field:
The code for which is here
<script type="text/javascript"> function getOption() { var hiddenCarId = document.getElementById("hCar"); var carId = document.getElementById("carId"); hiddenCarId.value = carId.value; document.theform.submit(); } </script> <bodyt> <form method="POST" action="" name="theform"> </form> </body>
More From Oodles
Ready to innovate? Let's get in touch
Request for Proposal
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Himanshu Agarwal
He works on Frontend Technologies like Javascript, Angular, HTML, CSS, jQuery.