Pass/Fail Dropdown expands a Notes text input

I have 5 dropdown boxes with a Passed or Failed value. If any of the dropdowns are changed to Failed I need a notes box to appear at the bottom.

I can make the notes appear using an onChange with if and else but when used on all five boxes it overrides as you go through the other dropdowns. I’ve battled to get to this point with the form using code but I can’t for the life of me figure out how to make this last bit work!

Any help would be massively appreciated :pray:

$w . onReady ( function () {
$w ( β€˜#dropdown1’ ). onChange (() => {
if ( $w ( β€˜#dropdown1’ ). value === β€˜Failed’ ){
$w ( β€˜#failNotes’ ). expand ();
} else {
$w ( β€˜#failNotes’ ). collapse ();
}
});

});

I’ve moved a little further with this now and have the following code:

$w . onReady ( function () {
$w ( β€˜#fireGlass’ ). onChange ( ( event ) => {
checkResult ();
} );

$w ( β€˜#iStrip’ ). onChange ( ( event ) => {
checkResult ()

} );

$w ( β€˜#doorClose’ ). onChange ( ( event ) => {
checkResult ()

} );

$w ( β€˜#fireDoor’ ). onChange ( ( event ) => {
checkResult ()

} );

$w ( β€˜#doorDamage’ ). onChange ( ( event ) => {
checkResult ()

} );

});

function checkResult ( ) {
let input1 = $w ( β€œ#fireGlass” ). value ;
let input2 = $w ( β€œ#iStrip” ). value ;
let input3 = $w ( β€œ#doorClose” ). value ;
let input4 = $w ( β€œ#fireDoor” ). value ;
let input5 = $w ( β€œ#doorDamage” ). value ;

What I want to do now is check all five inputs match β€˜Passed’ value but if any return β€˜Failed’ then the Failure Notes text box expands.

Is this the right way to approach it and could someone point me in the right direction for comparing the values?

Thank you