title: Dropdown list textbox required field validator error
body: <p>I have a dropdown list for the which values are coming from DB. There is one option name OTHER, when I select other the textbox appears. For that Textbox I have made a required field validator. Till here it works fine. But when I select any other option, still it gives me validator errors. It should not happen. It should only give me required field error when the user doesn't fills the textbox on select of OTHER option. Please see the code.</p>
  
  <p>Dropdown and Textbox code:-</p>
  
  <pre><code>&lt;asp:DropDownList ID="ddlGraduation" runat="server" CssClass="txtfld-popup_drp"&gt;&lt;/asp:DropDownList&gt;
  
   &lt;asp:RequiredFieldValidator CssClass="error_msg" ID="reqGraduation" runat="server" ControlToValidate="ddlGraduation" ErrorMessage="Please select graduation details" InitialValue="--Select--" SetFocusOnError="true"&gt;&lt;/asp:RequiredFieldValidator&gt;
  
  
  
  &lt;asp:TextBox ID="txtOther" runat="server" CssClass="txtfld-popup_p"&gt;&lt;/asp:TextBox&gt;                                                                                
  
  
  &lt;asp:RequiredFieldValidator ID="reqOther" runat="server" ControlToValidate="txtOther" ErrorMessage="Please specify your qualification"&gt;&lt;/asp:RequiredFieldValidator&gt;
  </code></pre>
  
  <p>JS code for hiding and show the textbox when user select and deselect the OTHER option from dropdown list:-</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function pageLoad() {
          $('#ctl00_ContentPlaceHolder1_txtOther').hide();
          $('#ctl00_ContentPlaceHolder1_ddlGraduation').change(function () {
              if ($(this).val() === "Other") {
                  $('#ctl00_ContentPlaceHolder1_txtOther').show();
                  // $("#ctl00_ContentPlaceHolder1_ddlGraduation").hide();
              } else {
                  $('#ctl00_ContentPlaceHolder1_txtOther').hide();
              }
          });
  </code></pre>
  
  <p></p>