Click here to Skip to main content
15,851,242 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Experts,
I have a Register page in which a terms and condition section is present Inside Wizard control which contain a checkbox.It must be checked when user click the next button of wizard.Otherwise it will show a message please check terms & condition.I have tried the following script but it isnot working for wizard control

XML
<SCRIPT type="text/javascript">
<!--
//Accept terms & conditions script (by InsightEye www.insighteye.com)
//Visit JavaScript Kit (http://javascriptkit.com) for this script & more.
function checkCheckBox(f){
if (f.ctl00_ContentPlaceHolder1_Wizard2_chkAgree.checked == false)
{
alert('Please check the box to continue.');
return false;
}else
return true;
}
//-->
</SCRIPT>



Please provide me the solution
Thank You
Sandeep (Software Developer)
Posted
Comments
Sunasara Imdadhusen 29-Jan-11 6:20am    
I think f.ctl00_ContentPlaceHolder1_Wizard2_chkAgree it return NULL please try to following in Alert box
alert(f.ctl00_ContentPlaceHolder1_Wizard2_chkAgree)
and let me know what will be Alert box value?

1 solution

Please use following

C#
function checkCheckBox(){
var chk = document.getElementById('<%=chkAgree.ClientID%>');
  if (chk.checked == false)
  {
     alert('Please check the box to continue.');
     return false;
  }
  else
    return true;
}


Thanks,
Imdadhusen

Updates Note:-
I have removed parameter from function because now it is no more nedded!
C#
function checkCheckBox()
 
Share this answer
 
v2
Comments
Sandeepost 31-Jan-11 1:27am    
Thank You very much sir
It is working fine now
sapien4u 1-Feb-11 4:21am    
It helped in my case too.
thank you
Sunasara Imdadhusen 2-Feb-11 8:36am    
Thanks for your applications!!

If you would getting solution then you should provide Vote and Mark as Accepted Solution.
Sunasara Imdadhusen 2-Feb-11 8:40am    
I have also update answer because i removed parameter from function because it was no more needed!

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