﻿//Custom Validation Function for Incident Reports
 function isValidRequiredTextBoxWithCheckBox(sender,args)
        {               
           args.IsValid = false;
           
           //find the textBox
           var txtBox = document.getElementById(sender.controltovalidate);
           
           //replace the textbox id with checkbox          
           var chkBoxID = txtBox.id.replace("TextBox", "CheckBox");
          
           //find the checkbox
           var chkBox = document.getElementById(chkBoxID);
           
           //check for null reference
           if(chkBox != undefined && chkBox != null) 
           {    
                //check for null reference
               if(txtBox != undefined && txtBox != null) 
               {    
                    //check if checkbox is checked
                    if (chkBox.checked == true)
                    {   
                        //check txtbox is not empty
                        args.IsValid = txtBox.value.length > 0; 
                    }
                    
                    else
                    {   
                        //checkbox is not check return true
                        args.IsValid = true;
                    }
                     
                }//end if
            }//end if
           
           
                return args.IsValid;               
                           
        }//end function 
        
        
function ValidatePasswordLength(sender,args)
{
     args.IsValid = false;
    var str = document.getElementById(sender.controltovalidate);
    
     //check for null reference
     if(str != undefined && str != null) 
     {    
        //valid length is at least 7 characters
        args.IsValid = str.value.length >= 7;    
                     
      }//end if
      
}//end function
