switcher
. In order to simplify testing, I temporarily changed the core form /administrator/components/com_content/config.xml
.<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
.
I cannot change the value of the field. It is displayed as a readonly
displayed
field.
Nothing changes. The field can be edited as normal. The display is also such that you have the impression that the field is active.
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>
Labels |
Added:
?
|
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.
Build | staging | ⇒ | 4.0-dev |
confirmed. Probably a javascript task.
Status | New | ⇒ | Confirmed |
How should disabled switcher look like? btn-group-yesno
radio also doesn't have readonly styling.
In my opinion it should be gray and it should not be possible to change the state of the switcher
It is already gray when "negative" option is selected.
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
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:
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-03-22 16:06:59 |
Closed_By | ⇒ | astridx |
Closed because we have provided.
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.