1

I'm building a custom module with it's own configuration tabs, sections and fields. So here's the thing:
I have a select field. Based on the value of that select I'd like to show another field or hide it. I know that this is done as follows:

<depends><parentfieldname>value</parentfieldname></depends>

How is it possible to allow for multiple values? I've tried the following:

<!-- two field-specifying tags, field appears ONLY when 'bananas' is selected -->
<depends><fruit>apples</fruit><fruit>bananas</fruit></depends>

<!-- two 'depends' tags, field appears ONLY when 'bananas' is selected -->
<depends><fruit>apples</fruit></depends>
<depends><fruit>bananas</fruit></depends>

<!-- doesn't work, field won't appear -->
<depends><fruit>apples,bananas</fruit></depends>

<!-- doesn't work, field won't appear -->
<depends><fruit>apples|bananas</fruit></depends>

I read this before asking this question, pretty much the same but then applied to multiple values. I suppose a multiselect field could have a value like 'apples,bananas', but I'm looking for a way to allow for value1 OR value2, not value1 AND value2.

Community
  • 1
  • 1
pancake
  • 1,923
  • 2
  • 21
  • 42

1 Answers1

1

You need to add the separator param like bellow

<depends> <fruit separator=",">apples,bananas</fruit> </depends>