Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    undefined is null or not an object in a validator

    Hello all. I am trying to track down why this custom validator is failing with an error that args is undefined. There are two funnctions - one works and one does not. Here they are: the bold italicized item is where the error is being generated. Function validHygieneNote works as expected however.
    Code:
    function validClothingNote(val,args)
    {
    var radio_choice = false;
    var chks = document.getElementById('clothingNote');
    var chks2 = document.getElementsByName('clothingInadequate');
    
    for (counter=0; counter < chks2.length; counter++) {
    if (chks2[counter].checked){
    var rad_val =chks2[counter].value;
    }}
    
    
    if((rad_val==1)|| (rad_val==2)) {
    
    if ((chks.value=="") || (chks.value.length==0) || (chks.value==null)){
    args.IsValid=false; 
    }
    else {
    args.IsValid = true;
    }
    }}
    
    function validHygieneNote(val,args)
    {
    var radio_choice = false;
    var chks = document.getElementById('hygieneNote');
    var chks2 = document.getElementsByName('hygieneInadequate');
    
    for (counter=0; counter < chks2.length; counter++) {
    if (chks2[counter].checked){
    var rad_val =chks2[counter].value;
    }}
    
    
    if((rad_val==1)|| (rad_val==2)) {
    
    if ((chks.value=="") || (chks.value.length==0) || (chks.value==null)){
    args.IsValid=false; 
    }
    else {
    args.IsValid = true;
    }
    }}

  • #2
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Found the problem. I was calling the function without any args on another place in the form.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •