J4 Issue ?
avatar frogydiak
frogydiak
21 Oct 2018

Steps to reproduce the issue

There are 3 fields involved in my I've done.

First, I created a list field named repeat_type

<field name="repeat_type" type="list" label="REPEAT_TYPE_LABEL" description="REPEAT_TYPE_DESC" labelclass="ch-w-full" > <option value="0">OPTION_EVENT_NO_REOCCURENCE</option> <option value="1">OPTION_EVENT_DAILY</option> <option value="2">OPTION_EVENT_WEEKLY</option> <option value="3">OPTION_EVENT_MONTHLY</option> <option value="4">OPTION_EVENT_CUSTOM</option> </field>

Second, create a radio field with class="btn-group btn-group-yesno" then add a showon attribute so it only show when value 3 (OPTION_EVENT_MONTHLY) is selected.

<field name="monthly_by_day_or_weekday" type="radio" label="MONTHLY_REOCCURENCE_BY_DAY_OR_WEEKDAY_LABEL" description="MONTHLY_REOCCURENCE_BY_DAY_OR_WEEKDAY_DESC" class="btn-group btn-group-yesno" default="1" showon="repeat_type:3" > <option value="1">OPTION_EVENT_MONTHLY_REOCCURENCE_SELECT_BY_DAY</option> <option value="0">MONTHLY_REOCCURENCE_SELECT_BY_WEEKDAY</option> </field>

Third, create two fields: monthly_by_day and monthly_by_weekday

<field name="monthly_by_day" type="list" default="" label="MONTHLY_REOCCURENCE_DAY_OF_MONTH_LABEL" description="MONTHLY_REOCCURENCE_DAY_OF_MONTH_DESC" showon="repeat_type:3[AND]monthly_by_day_or_weekday:1" > <option value="">MONTHLY_REOCCURENCE_SELECT_DAY_OF_MONTH</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </field>

Then

<field name="monthly_by_weekday" type="list" default="" multiple="true" label="MONTHLY_REOCCURENCE_WEEK_OF_MONTH_LABEL" description="MONTHLY_REOCCURENCE_WEEK_OF_MONTH_DESC" showon="repeat_type:3[AND]monthly_by_day_or_weekday:0" > <option value="">OPTION_SELECT_A_WEEK_NAME</option> <option value="1">OPTION_SELECT_A_WEEK_NAME_MONDAY</option> <option value="2">OPTION_SELECT_A_WEEK_NAME_TUESDAY</option> <option value="3">OPTION_SELECT_A_WEEK_NAME_WEDNESDAY</option> <option value="4">OPTION_SELECT_A_WEEK_NAME_THURSDAY</option> <option value="5">OPTION_SELECT_A_WEEK_NAME_FRIDAY</option> <option value="6">OPTION_SELECT_A_WEEK_NAME_SATURDAY</option> <option value="7">OPTION_SELECT_A_WEEK_NAME_SUNDAY</option> </field>

Expected result

In the field monthly_by_day_or_weekday, if I select option 1, only the field named monthly_by_day will be shown or if I select option 2 only the field named monthly_by_weekday will be shown. But...

Actual result

In the field setting, field monthly_by_day will be shown since it is the default. But when I click on option 2, the field monthly_by_day is still showing. But if I refresh the page, option 2 is now the default and it will show monthly_by_weekday. What I'm trying to say is the shownon toggle is not working with radio field.

Additional Comment

As of Sunday, 21 October 2018 02:00:33 UTC update package, refreshing the page no longer change anything. It will only show whatever default option set in the field monthly_by_day_or_weekday.

Here's a screen capture:

https://monosnap.com/file/t934ju5zKCqKlICIYnoJGPXeFpU2mN

avatar frogydiak frogydiak - open - 21 Oct 2018
avatar joomla-cms-bot joomla-cms-bot - change - 21 Oct 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Oct 2018
avatar frogydiak frogydiak - change - 21 Oct 2018
The description was changed
avatar frogydiak frogydiak - edited - 21 Oct 2018
avatar frogydiak frogydiak - change - 21 Oct 2018
The description was changed
avatar frogydiak frogydiak - edited - 21 Oct 2018
avatar C-Lodder
C-Lodder - comment - 22 Oct 2018

Are you getting any errors on your browser console?

avatar frogydiak
frogydiak - comment - 22 Oct 2018

@C-Lodder No I don't

avatar dgrammatiko
dgrammatiko - comment - 22 Oct 2018

It's my fault I guess, the new code is using some aggressive caching (the old one recalculated everything on each change). Obviously the old way (no caching at all) works in this case but it's also really bad so we shouldn't fall back to that. IIRC there are couple arrays with the elements (primary[parent] and secondary[child] the ones that depend on a primary) so the way out here is to recalculate the secondary elements more aggressively when a primary (parent) element is changed.

But maybe a missing trigger either on the input type-"radio" or the select element [debug this starting from this...]

avatar brianteeman brianteeman - change - 30 Oct 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 30 Oct 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 29 Mar 2019
Category JavaScript
avatar stutteringp0et
stutteringp0et - comment - 6 Nov 2019

It doesn't seem to matter if the radio has the btn-group-yesno class or not. Switching to list field type works.

avatar jwaisner jwaisner - change - 19 Mar 2020
Status Discussion Confirmed
Build master 4.0-dev
avatar Quy Quy - change - 26 Jun 2020
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2020-06-26 15:11:56
Closed_By Quy
avatar Quy
Quy - comment - 26 Jun 2020

Fixed in #29462

avatar Quy Quy - close - 26 Jun 2020

Add a Comment

Login with GitHub to post a comment