In this part of code we need to disable submit button until all fields are selected or-else every thing gets messed up! So is it possible to disable the submit button ? If so kindly help us!!
out.println("<html><body><form action=''>");
out.println("<br><center><h1><font color='red'>Detailed DocID Status</font></h1>");
out.println("<br> Year <select name='year'>");
out.println("<option value=''>Select Year</option>");
for(int i=2010;i<=2020;i++){
out.println("<option value="+i+">"+i+"</option>");
}
out.println("</select>");
out.println(" Month <select name='month'>");
out.println("<option value=''>Select Month</option>");
out.println("<option value='01'>Jan</option>");
out.println("<option value='02'>Feb</option>");
out.println("<option value='03'>Mar</option>");
out.println("<option value='04'>Apr</option>");
out.println("<option value='05'>May</option>");
out.println("<option value='06'>June</option>");
out.println("<option value='07'>July</option>");
out.println("<option value='08'>Aug</option>");
out.println("<option value='09'>Sep</option>");
out.println("<option value='10'>Oct</option>");
out.println("<option value='11'>Nov</option>");
out.println("<option value='12'>Dec</option>");
out.println("</select>");
out.println(" Status : <select name='status'><option value='Select Status'>Select Status</option><option value='Approved'>Approved</option><option value='Clarifications'>Clarifications</option><option value='Pending'>Pending</option></select> ");
out.println("<input type='submit'id='submit' name='subBtn' value='Submit' disable='disabled' onClick=doenable()>");
out.println("</form></body></html>");
out.println("<br><br>");
Function we tried
function doenable()
{
if(document.getElementById("year")!=null)
{
if(document.getElementById("month")!=null)
{
if(document.getElementById("status")!=null)
{
document.getElementById("subBtn").disabled=false;
}
}
}
}