views:

39

answers:

1

I want to validate radio button, when i checked radio button textbox will be disabled, but it cant happens. what will be the exact js for validate radio button.

My JS code is :

function selection_project_phd() { var phds = document.getElementById('EmployeeGuidedProjectPhd').value; var projs = document.getElementById('EmployeeGuidedProjectProject').value; var course_name = document.getElementById('EmployeeGuidedProjectCourseName').value; if(phds == 1) { course_name.disable=true; return false; } else if(projs==0) { course_name.disable=false; return false; } return true; }

This one is View file .ctp code

Phd Project

+2  A: 
function selection_project_phd() { 
    var phds = document.getElementById('EmployeeGuidedProjectPhd').checked; 
    var projs = document.getElementById('EmployeeGuidedProjectProject').checked; 
    var course_name = document.getElementById('EmployeeGuidedProjectCourseName'); 
    if(phds) { course_name.disable=true; return false; } 
    else if(projs !== true ) { course_name.disable=false; return false; } 
    return true;  
}
NM
thanxs ,it working
Msofts
you might want to vote up and accept the answer :) Welcome to Stack overflow !
NM