Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

button disable until all required fields are filled

$
0
0
hi i am 4 textboxes & one dropdownlist.all are mandatory.items for dropdown list are retrieved from database.they are "select",6,7,8,9 &10.by default select is displayed.until i fill all 4 textboes & select one of the five options ie 6,7,8,9 &10 button should be disabled.i am using javascript function
<scripttype="text/javascript">
     function EnableUpload() {
         if (document.getElementById("<%=txtfirstname.ClientID %>").value != ""&& document.getElementById("<%=txtlastname.ClientID %>").value != ""&& document.getElementById("<%=txtemailid.ClientID %>").value != ""&& document.getElementById("<%=txtpwd.ClientID %>").value != ""&& document.getElementById("<%=ddlusertypeid.ClientID %>").value != "") {
             document.getElementById("<%=btnSubmit.ClientID %>").disabled = false;
         }
         else {
             document.getElementById("<%=btnSubmit.ClientID %>").disabled = true;
         }
     }
 
    </script>
the pbm i am facing here is i am not selecting an item from dropdownlist.even then the button is enabled.but actually button should be disabled until i select one of the items(6,,8,9 &10).pls help me how to achieve this...
<asp:DropDownListID="ddlusertypeid"runat="server"MaxLength="60"onChange= "javascript:EnableUpload();"AutoPostBack="True"></asp:DropDownList>

Viewing all articles
Browse latest Browse all 3938

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>