single radio button validation
                            
            hi, i have a problem with radio button.
i generate dinamically my radio button and if i have only one radio button i can't use the radio button length because it's undefined.
Can i do for validate it?
            
                    Status: 
                Open    May 04, 2009 - 07:25 AM
            
            
                Button, validation
            
                
                            
                    
                
         
     
    
        3answers
                    
        
            
                Answers
        
    May 05, 2009 - 05:51 AM
    what do you want to validate it?
Do you mean you want to validate the value?
        
    
 
 
                            
        
    May 06, 2009 - 09:03 AM
    claudio in this way u validate the button of radio look simple program:
 
!
 
 
 1st
 2nd
 3rd
 
 
 
 
 
 
        
    
 
 
                            
        
    May 11, 2009 - 01:04 AM
    Hi, i buyild dinamically my radio button and when there is only one of this this javascript don't function.
I post my solution for this ptoblem :
 function isOneCheked(objForm){
            for(jj=0; jj<= objForm.check_user.length; jj++)
            {
                if(objForm.check_user[jj].checked)
                {
                    break; 
                    return true;
                }
            }
            return false;
        }
        function sigleRadioValue(objForm){
            if(objForm.check_user.checked){
                return true;
            }else{
                return false;
            }
        }
        function validateChekSelection(objForm){
            if(!isOneCheked(objForm))
            {
                if(!sigleRadioValue(objForm)){
                    window.alert("Selezionare almeno un utente");
                    return ;  
                }else{
                    objForm.submit();
                }
            }else
            {
                objForm.submit();
            }
        } 
        
    
 
 
                
             
         
    Answer this question    
    
    
        
        
            Share Your Own Experience & Expertise
            We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives.  Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
            
            
         
 
                            
Add New Comment