[RESOLVED] Disable Fields using CheckBox

Hi,

I typed this script but it doesn't seem to be working.

I want this script to disable a field once the checkbox has been selected as well as disable the checkbox field once it's been selected.

fd.spRendered(function(){
    function disableQuestions(){
        if fd.field('Terms_Conditions').select; {
        fd.field('Question_2').disabled = true; 
        }
    }
//calling Terms and condiition
fd.field('Terms_Conditions').$on('change',disableQuestions);

//Calling DisableQuestion on Form Load
disableQuestions();        
});

Dear @DryChips,
This is not even viable JavaScript, it wouldn't work.

This on the other hand might work, if you use Yes/No field and the Internal field names match:

fd.spRendered(function(){
    function disableQuestions(){
        if (fd.field('Terms_Conditions').value) {
          fd.field('Question_2').disabled = true; 
        }
       else{
          fd.field('Question_2').disabled = false; 
       }
    }
    //calling Terms and condiition
    fd.field('Terms_Conditions').$on('change',disableQuestions);

    //Calling DisableQuestion on Form Load
    disableQuestions();        
});

If it doesn't work - check browser's console for errors.

1 Like

Hi Nikita,

Thanks for your solution.

I cooked up this code and it seems to work fine:

fd.spRendered(function(){
    function disableQuestions(){
        if (fd.field('Terms_Conditions').value.length != 0); {
        fd.field('Question_2').disabled = true; 
        }
    }
//calling Terms and condiition
fd.field('Terms_Conditions').$on('change',disableQuestions);

       
});