Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] radio field and btn group doesn't work in subform #40160

Closed
micker opened this issue Mar 21, 2023 · 10 comments
Closed

[4.3] radio field and btn group doesn't work in subform #40160

micker opened this issue Mar 21, 2023 · 10 comments

Comments

@micker
Copy link

micker commented Mar 21, 2023

Hello
i am testing subform + showone feature of joomla 4.3
i works in subform > suform > field
if we use class="btn-group" in 2sc level of subform radio form is broken
2023-03-21_21h07_17
if i don't use css class radio field is usuable and showone works
2023-03-21_21h08_58
=> i didn't see any js error in my browser

my original code

<?xml version="1.0" encoding="UTF-8"?>
<form>
	<field name="displayButtonTypeOption" label="Type of button" description="MOD_DASHBOARD_DISPLAY_LINE_DESC" type="radio" default="0" class="btn btn-group">
		<option value="1">Add item</option>
		<option value="2">Edit item</option>
		<option value="3">Link to categorie</option>
		<option value="4">Custom button</option>

	</field>
<!--Add item -->
	<field name="button_name" label="MOD_DASHBOARD_NAME_BUTTON" description="MOD_DASHBOARD_NAME_BUTTON_DESC" size="30" type="text"/>
	<field name="catid" type="category" extension="com_content" multiple="false" label="MOD_DASHBOARD_CAT" description="MOD_DASHBOARD_CAT_DESC" showon="displayButtonTypeOption:1" />

<!--Edit item -->
 <field name="nameitemedit" type="text" label="MOD_DASHBOARD_NAME_BUTTON" description="MOD_DASHBOARD_NAME_BUTTON_DESC" showon="displayButtonTypeOption:2"/>
  <field name="itemid" type="text" size="5" label="MOD_DASHBOARD_ITEM" description="MOD_DASHBOARD_ITEM_DESC" showon="displayButtonTypeOption:2"/>

<!--Link to categorie-->
	<field name="namecatfilter" type="text" label="MOD_DASHBOARD_NAME_BUTTON" description="MOD_DASHBOARD_NAME_BUTTON_DESC" showon="displayButtonTypeOption:3"/>
	<field name="catidlist" type="category" extension="com_content" multiple="false" label="MOD_DASHBOARD_CAT" description="MOD_DASHBOARD_CAT_DESC" showon="displayButtonTypeOption:3" />
	<field name="displayauthoronly" label="MOD_DASHBOARD_DISPLAY_AUTHOR_ONLY" description="MOD_DASHBOARD_DISPLAY_AUTHOR_ONLY_DESC" type="radio" default="0" layout="joomla.form.field.radio.switcher" showon="displayButtonTypeOption:3">
		<option value="0">JNO</option>
		<option value="1">JYES</option>
	</field>
<!--Free button-->
	<field name="linkbutton" type="text" label="MOD_DASHBOARD_FREE_LINK" description="MOD_DASHBOARD_FREE_LINK_DESC" showon="displayButtonTypeOption:4" />
<!--common option-->
	<field name="iconbutton" type="iconpicker" default="" label="MOD_DASHBOARD_ICON" description="MOD_DASHBOARD_ICON_DESC" />
	<field name="coloricon" type="color" default="" format="rgba" label="MOD_DASHBOARD_ICON_COLOR" description="MOD_DASHBOARD_ICON_COLOR_DESC"/>
		<field name="button_lang" type="contentlanguage" label="MOD_DASHBOARD_LANG" description="MOD_DASHBOARD_LANG_DESC" class="span12 small">
		<option value="*">JALL</option>
	</field>
	<field name="targetlink" label="MOD_DASHBOARD_TARGETLINK" description="MOD_DASHBOARD_TARGETLINK_DESC" type="radio" default="_self" class="btn btn-group btn-yes-no">
		<option value="_self">MOD_DASHBOARD_SELF</option>
		<option value="_blank">MOD_DASHBOARD_BLANK</option>
	</field>
	<field name="displayline" label="MOD_DASHBOARD_DISPLAY_LINE" description="MOD_DASHBOARD_DISPLAY_LINE_DESC" type="radio" default="0" layout="joomla.form.field.radio.switcher">
		<option value="0">JNO</option>
				<option value="1">JYES</option>
	</field>
</form>

thanks for any help or return

@obuisard
Copy link
Contributor

In Joomla 4, you should use layout="joomla.form.field.radio.switcher" rather than class="btn-group" for fields having 0/1 values. If you have more than 2 values, you should use type 'list' rather than 'radio'.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40160.

@obuisard
Copy link
Contributor

Hope that helps :-)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40160.

@micker
Copy link
Author

micker commented Mar 22, 2023

@obuisard i know that but my return isn't about this ... radio works but not class its a bug not ? using select only for 4 items isn't a good ux solution in this case. Error is same if you want to add a radio button only with 2 values (but no switcher because isn't yes/no question)

@brianteeman
Copy link
Contributor

Are there any javascript errors in the console?

@micker
Copy link
Author

micker commented Mar 22, 2023

no, nothing

@micker
Copy link
Author

micker commented Mar 23, 2023

i test same subform code not in existing subform (root) that works
problem seems appair in subform of subform

@obuisard
Copy link
Contributor

I have seen it being a challenge to have stylings and showon script work properly in subforms. We may still have issues with subforms of subforms...

@Hackwar Hackwar added bug PBF Pizza, Bugs and Fun labels Aug 22, 2023
@brianteeman brianteeman removed the PBF Pizza, Bugs and Fun label Sep 1, 2023
@g-e-n-e-z-i-s
Copy link

Is there any solution for this bug? Radio buttons are not active/selectable in repeatable subforms.

@g-e-n-e-z-i-s
Copy link

still nothing?

@Fedik
Copy link
Member

Fedik commented Jun 15, 2024

Please test #43660

@Fedik Fedik closed this as completed Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants