I am currently working on a simple javascript function with show and hide functions. At the same time, I want to validate null value for the hide element which is file type. Unfortunately, in html I used required to validate null function for the hidden element. Therefore, I am looking for how to disable hidden element.
This is javascript function code :
<script>    
    function database_csv(){    
        document.getElementById('send_type').style.display = "none";
        $("#send_type :input").prop("disabled", true);
    }
    function csv_database(){
        document.getElementById('send_type').style.display = "block";
        $("#send_type :input").prop("disabled", false);
    }
</script>
And this is html code :
<form action="confirm_sendemail.php" method="post" enctype="multipart/form-data" name="form1" id="form1" > 
  Subject : <br/>
  <input type="text" name="subject" id="subject" required/> <br/>
  Choose your upload type: <br /> 
  <input type="radio" name="email" id="database" onclick="database_csv()" checked value="databse"/>Database
  <input type="radio" name="email" id="csv" onclick="csv_database()" value="csv"/>CSV<br/>
  <div id="send_type" style="display:none">
    <input name="csv" type="file" id="csv" accept=".csv" required/> <br/>
  </div>
  Content : <br/>
  <textarea name="message" cols="50" rows="10" required></textarea><br/>
  <input type="submit" name="submit" value="Submit"/> 
</form> 
 
     
     
    