2

I presently have a form that contains a radio button group with 2 options. I would like that section 1 shows when I pick the first option and section 2 shows when I pick the second.

Currently Section 1 (Credit Union) always shows no matter what I select and upon load.

Here is what I have for my conditions:

Sitecore Conditions

I have read this thread: Sitecore 9.1 Forms conditional logic not working as expected and tried to format my condition how they suggested, but they only show 2 options.

2
  • What version of sitecore are you using? I just tried the exact same as a test and worked as expected. Oct 10, 2022 at 8:47
  • @DeanOBrien I am using the following version: 10.2.1 (rev. 007937 PRE)
    – elke_wtf
    Oct 10, 2022 at 13:31

1 Answer 1

2

I have been able to recreate the problem you are having locally and as that other post says Sitecore Forms logic is indeed weird!

As that post states, it looks at each condition in order and if its true applies your action, but if not it applies the inverse of the action. The last action to influence an objects state is the one that is applied.

In your case, because you want to hide both sections if radio is empty, you need that to be the last condition (otherwise the other radio conditions would make one of the section show if applied after). The problem is though... by adding that condition as last condition, when it is not true (i.e. radio selected) the INVERSE is applied last - so both are set to show.

I dont believe it is therefore possible to add a set of conditions to achieve your goal, based on the current layout of your page.

My suggestion would be to add an invisible parent section, that surrounds the other two sections. Then apply a single condition referencing that. So if radio is empty, hide the parent section.

You can then apply a further condition, stating if radio is equal to "Credit Union", show/hide sections within the parent. Note, due to the fact the inverse will be applied if NOT true, you only need the one condition adding, because if it is not equal to "Credit Union" then the inverse is to hide credit union and show organization name section.

Hopefully the screenshot below shows what I mean.

enter image description here

1
  • This was mostly correct! I got it to work using a combination of this and then I did also have to add the opposition condition for the "other" field, otherwise they would both show when initially selecting "Credit Union".
    – elke_wtf
    Oct 10, 2022 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.