Show/hide not behaving as expected
I'm having an issue making a dropdown field appear depending on what is chosen in another dropdown and I don't know how to rectify it, so any help would be gratefully received. I am a novice with all this, so please keep any replies simple - thank you.

Part 1 - this works perfectly
A is the document Title and there are 3 options in the dropdown
B is a dropdown on page 2. This dropdown must only be visible if option 1 or 3 from the Title dropdown A is chosen.
Part 2 - this also works perfectly
B has 6 options in its dropdown, and each option makes other fields appear on the document. When a selection is made, dropdown B is hidden.
My problem is when I try and put them together. Regardless of what option is chosen in A, Dropdown B is visible. I think something is conflicting, but I don't know where or what!
In the custom calculation script box of dropdown B, I have this that makes Part 1 work:
if (this.getField("ContractTitleA").value == "Abonnement Global Services"){
(this.getField("DropdownB").display = display.visible;}
else if (this.getField("ContractTitleA").value == "Abonnement Connect – Relay Hub"){
(this.getField("DropdownB").display = display.visible;}
else{
event.target.display = display.hidden;
}
followed by this (only showing 2 lines here) for Part 2:
if (this.getField("DropdownB").value == "Equipement(s) auto-installable(s)"){
event.target.display = display.hidden;}
else if (this.getField("Installation choice_es_:prefill").value == "Machine à affranchir déjà installée"){
event.target.display = display.hidden;}
else{
event.target.display = display.visible;
