Skip to content

[4.0] Readonly doesn't work with switcher #27760

@astridx

Description

@astridx

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions