The showon
feature of XML fields's settings in Joomla works well in Joomla 4 according to my tests. The issue that 'showon' works or not does not have too much to do with HTML Tabs basically, but it has a lot to do with XML Fields and Field. You create HTML Tabs and display different Fieldsets/Fields/Field within the different Tabs and the fields within the tabs are usually within different Fields nodes in the XML.
For example you have X number of Tabs and you set a showon condition for a field in your 5th Fieldsets/Fields (in 5th Tab of your Form) dependent on a Field value in 4th Fieldsets' Fields' (in 4th Tab), then you should target the <Field>
of the targeted particular <Fields>
node when you are setting a showon
condition, like "fieldsname.fieldname:1"
, so you not only set fieldname:1
.
That way in your 5th Tab the field with a showon condition - targeting the 4th Tab's field value - will respond according to the 4th Tabs field value setting.
In my test XML you can see this setting in the different <Fieldsets>
and <Fields>
. For you the last <Field>
is interesting to check in this example.
<fieldset name = "showg">
<fields name="showfieldsg">
<field
name="hasEndDate"
type="list"
label="Hat Enddatum?"
default="1"
>
<option value="0">Nein</option>
<option value="1">Ja</option>
</field>
<field
name="endDate"
type="calendar"
translateformat="true"
singleheader="false"
showtime="true"
timeformat="24"
todaybutton="true"
label="Ende: Datum und Zeit"
weeknumbers="true"
size="20"
filter="server_utc"
showon="hasEndDate:1"
/>
<field
name="nextTabValue"
type="list"
label="Next Tab Field show?"
default="1"
>
<option value="0">No</option>
<option value="1">Yes</option>
</field>
</fields>
</fieldset>
<fieldset name = "showi">
<fields name="showfieldsi">
<field
name="TestPrevTab"
type="list"
label="Test Previous Tab Setting"
default="1"
showon="showfieldsg.nextTabValue:1"
>
<option value="0">No</option>
<option value="1">Yes</option>
</field>
</fields>
</fieldset>
So shortly, within the same Fieldsets' Fields the showon condition works as usual but if one of your fields depends on another Fieldset's Fields value then you should target the Fieldsname.Fieldname
in the showon condition and it will work.
And the visual working result of these tabs and field's showon test in Tabs is here:
https://imagizer.imageshack.com/img923/1135/Himm8V.gif