Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Below is my code.. am getting the Microsoft Jscript run time error : object required error when the control moves to the first If statement.
JavaScript
if ((document.getElementById("cphContents_chktimetoschedule").checked == true) && (document.getElementById("cphContents_pnltimetoschedule").disabled == false))
{
    var aDate = new Date(document.getElementById("cphContents_txtapproval").value)
    var sDate = new Date(document.getElementById("cphContents_txtsubmission").value)
     
     if(approval.value == "" || submission.value == "")
        {
            alert("Please enter all the fields of Project Time to Schedule.");
            return false;
        }
Posted
Updated 1-Jan-12 21:16pm
v3

1 solution

Are you using Master pages(ASP.NET) in your application by any chance? If yes then check these

The difference between ID, ClientID and UniqueID[^]
Take Control Of Web Control ClientID Values in ASP.NET[^]

For example, use things like below
JavaScript
document.getElementById('<%=txtapproval.ClientID%>').value;

instead of
JavaScript
document.getElementById("cphContents_txtapproval").value;
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 2-Jan-12 3:42am    
Good point, a 5.
--SA
hitech_s 2-Jan-12 4:13am    
nice answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900