Click here to Skip to main content
14,828,871 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi...

:sigh: :(( :(( :((

I am using javascript for validation in asp.net...

but getting error like

object is required....
code is given below

XML
<script language="javascript" type="text/javascript">
function SaveConfirmMessage()
{
  if(document.getElementById('txtSite').value!=" ")
  {
  document.getElementById('hiddenvar').value=confirm("Are you sure,you want to Save Record?")
  
  }
}
function DeleteConfirmMessege()
{
  if(document.getElementById('txtSite').value!="")
 document.getElementById('hiddenvar').value=confirm("Are you sure,you want to Delete Record?")
 else
 alert("Record not Found")

}

</script>


m bored now....plz give :rolleyes: solution
Posted
Updated 12-Feb-10 1:08am
v2

Make sure that hiddenvar and txtSite exist.
   
you didn't mentioned whether you are using masterpage or not. anyway try the code like below.
document.getElementById('<%= this.txtSite.ClientID %>').value
instead of
document.getElementById('txtSite').value
   
every thing is exist yar...

i hav done it erlier easily....bt nw with same code its givig error:~ :omg: :omg:
   
thnks buddy.......gn :-D :laugh: ;)
   
<script language="javascript" type="text/javascript">
function SaveConfirmMessage()
{
  if(document.getElementById('txtSite').value!=" ")
  {
  document.getElementById('hiddenvar').value=confirm("Are you sure,you want to Save Record?");

  
  }
}
function DeleteConfirmMessege()
{
  if(document.getElementById('txtSite').value!="")
  {
 document.getElementById('hiddenvar').value=confirm("Are you sure,you want to Delete Record?");
  }
 else
  {
    alert("Record not Found");
  }
}

</script>
   
v2

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