Blog

  • 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.
     
    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>
    
    

Tags: html