I am currently writing a module with many backend settings, some of these use the "showon" attribute.
For example: I have two fields of type "list". In the second one, the options are evaluated with the "showon" of the first list.
<field name="fieldCat"
type="list"
default="0"
required=""
label="Category:"
description="">
<option value="">Select</option>
<option value="1">Category 1</option>
<option value="2">Category 2</option>
<option value="3">Category 3</option>
</field>
<field name="fieldItem"
type="list"
default="0"
required=""
label="Item:"
description="">
<option value="">Select</option>
<option value="1" showon="fieldCat:1">Item 1</option>
<option value="2" showon="fieldCat:2">Item 2</option>
<option value="3">Item 3</option>
</field>
If I set the first list to Category 1, Item 1 is displayed and can be selected.
But if I now select Category 2, Item 1 remains in the second list. Please see the picture:
Is it possible to reset the value of the second list (fieldItem) to default when changing the "higher-level" list (fieldCat)? Is this only possible with a custom field?
My currently soulution is, that I have separate subordinate lists (fieldItem1, fieldItem2) for each fieldCat value.
showon
’ is not for changing field values, so either you create a custom field solution on that or you use your already created solution.