?
avatar astridx
astridx
1 Feb 2020

Steps to reproduce the issue

  1. Create a form that contains a switcher. In order to simplify testing, I temporarily changed the core form /administrator/components/com_content/config.xml.
  2. I changed this code beginning on line 19
<field
	name="show_title"
	type="radio"
	label="JGLOBAL_SHOW_TITLE_LABEL"
	class="switcher"
	default="1"
	>
	<option value="0">JHIDE</option>
	<option value="1">JSHOW</option>
</field>

to

<field
	name="show_title"
	type="radio"
	label="JGLOBAL_SHOW_TITLE_LABEL"
	class="switcher"
	default="1"
	readonly="true"
	>
	<option value="0">JHIDE</option>
	<option value="1">JSHOW</option>
</field>

in the form /administrator/components/com_content/config.xml. I added readonly="true"

And i tried this code.

<field
	name="show_title"
	type="radio"
	label="JGLOBAL_SHOW_TITLE_LABEL"
	class="switcher readonly"
	default="1"
	readonly="true"
	>
	<option value="0">JHIDE</option>
	<option value="1">JSHOW</option>
</field>

in the form /administrator/components/com_content/config.xml. I addes the class readonly.

Expected result

I cannot change the value of the field. It is displayed as a readonly displayed field.

Actual result

Nothing changes. The field can be edited as normal. The display is also such that you have the impression that the field is active.
Articles  Options   test   Administration

System information (as much as possible)

Additional comments

If I delete the class switcher, the radio input works as expected. It is now readonly. But the style is not nive :)

<field
	name="show_title"
	type="radio"
	label="JGLOBAL_SHOW_TITLE_LABEL"
	class=""
	default="1"
	readonly="true"
	>
	<option value="0">JHIDE</option>
	<option value="1">JSHOW</option>
</field>

Articles  Options   test   Administration(1)

avatar astridx astridx - open - 1 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - change - 1 Feb 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 Feb 2020
avatar chmst
chmst - comment - 2 Feb 2020

See https://issues.joomla.org/tracker/joomla-cms/27555.
Sorry, @astridx , I did not read carfully.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27760.
avatar chmst
chmst - comment - 2 Feb 2020

Showon works in J4 only if fields are rendered as in layouts. Because the layout does this https://github.com/joomla/joomla-cms/blob/4.0-dev/layouts/joomla/content/options_default.php#L28.
Sorry, @astridx , I did not read carfully. This is another issue.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27760.
avatar jwaisner jwaisner - change - 15 Feb 2020
Build staging 4.0-dev
avatar chmst
chmst - comment - 16 Feb 2020

confirmed. Probably a javascript task.


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

avatar jwaisner jwaisner - change - 17 Feb 2020
Status New Confirmed
avatar SharkyKZ
SharkyKZ - comment - 15 Mar 2020

How should disabled switcher look like? btn-group-yesno radio also doesn't have readonly styling.

avatar astridx
astridx - comment - 15 Mar 2020

In my opinion it should be gray and it should not be possible to change the state of the switcher

avatar SharkyKZ
SharkyKZ - comment - 15 Mar 2020

It is already gray when "negative" option is selected.

avatar astridx
astridx - comment - 15 Mar 2020

I think the important thing is, that it should not be possible to change the state.
The styling could be a lighter gray than the "not selected"/negativ state

avatar Bakual
Bakual - comment - 15 Mar 2020

Let's have a look at https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly

The attribute is not supported or relevant to input types that are already not mutable, such as checkbox and radio

Also

Note: Only text controls can be made read-only, since for other controls (such as checkboxes and buttons) there is no useful distinction between being read-only and being disabled, so the readonly attribute does not apply.

Since the switcher technically is a radio element, it can't be readonly. You can only disable it.

In J3, readonly radios were technically automatically disabled and the button groups looked like this:
image

avatar astridx astridx - change - 15 Mar 2020
The description was changed
avatar astridx astridx - edited - 15 Mar 2020
avatar astridx
astridx - comment - 15 Mar 2020

@Bakual Since the switcher technically is a radio element, it can't be readonly. You can only disable it.

You are right, I meant disabled. I corrected it in the issue.

avatar Bakual
Bakual - comment - 15 Mar 2020

I took care of the technical side with #28356. The visual side has to be done by someone who has a clue ?

avatar astridx astridx - change - 22 Mar 2020
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2020-03-22 16:06:59
Closed_By astridx
avatar astridx
astridx - comment - 22 Mar 2020

Closed because we have provided.

avatar astridx astridx - close - 22 Mar 2020

Add a Comment

Login with GitHub to post a comment