Multiple "if" conditions

Hello Plumsail,

How do I perform a "If and AND" statement? I have two different dropdowns that, when specific conditions are met, a comment box becomes visible, but I'm struggling with the code. Thank you for your help.

image

Dear @ParAvion,
You're almost right, but you have { in between the two conditions, this would work, try:

if (fd.field('Action_x0020_Status').value == 'Completed' && fd.field('Action_x0020_Type').value == 'Task') { 
 //do something
}

@Nikita_Kurguzov thank you for the suggestion. Unfortunately, it's still not working. This is where I'm at...any thoughts?

fd.spRendered(function() {

    function sethideOrShowPhone() {
        if (fd.field('Action_x0020_Status').value == 'Completed' 
        && fd.field('Action_x0020_Type').value == 'Task') { 
            $(fd.field('Task_x0020_Comment').$parent.$el).show();
        } else {
            // Hide the Due Date field
            $(fd.field('Task_x0020_Comment').$parent.$el).hide();
        }
    }

    // Calling setPercentComplete when the user changes the status
    fd.field('Action_x0020_Status').$on('change',sethideOrShowPhone);
    fd.field('Action_x0020_Type').$on('change',sethideOrShowPhone);
    
    // Calling setPercentComplete on form loading
    sethideOrShowPhone();

});

Dear @ParAvion,
Everything looks correct to me here. Please, check browser's console for errors. You can also add some console.log statements to get more information:

fd.spRendered(function() {

    function sethideOrShowPhone() {
        console.log('Status: ' + fd.field('Action_x0020_Status').value);
        console.log('Type: ' + fd.field('Action_x0020_Type').value);
        if (fd.field('Action_x0020_Status').value == 'Completed' 
        && fd.field('Action_x0020_Type').value == 'Task') { 
            $(fd.field('Task_x0020_Comment').$parent.$el).show();
        } else {
            // Hide the Due Date field
            $(fd.field('Task_x0020_Comment').$parent.$el).hide();
        }
    }

    // Calling setPercentComplete when the user changes the status
    fd.field('Action_x0020_Status').$on('change',sethideOrShowPhone);
    fd.field('Action_x0020_Type').$on('change',sethideOrShowPhone);
    
    // Calling setPercentComplete on form loading
    sethideOrShowPhone();

});