Microsoft JScript runtime error: Object required

Posted by Nani on Stack Overflow See other posts from Stack Overflow or by Nani
Published on 2010-04-20T12:15:29Z Indexed on 2010/04/20 12:23 UTC
Read the original article Hit count: 286

Filed under:

I wrote a simple javascript function for validating to fields in a aspx page

function validate()

{
 if (document.getElementById("<%=tbName.ClientID%>").value=="")
  {
             alert("Name Feild can not be blank");
             document.getElementById("<%=tbName.ClientID%>").focus();
             return false;
  }
  if (document.getElementById("<%=ddlBranch.ClientID%>").value=="SelectBranch")
  {
             alert("Branch Should Be Selected");
             document.getElementById("<%=ddlBranch.ClientID%>").focus();
             return false;
  }

}

Everything worked fine. Later I linked it to aspx page like a external js file. Now its giving error "Microsoft JScript runtime error: Object required".

I'm unable to know where I went wrong.

© Stack Overflow or respective owner

Related posts about JavaScript