No Code Attached Yet
avatar C-Lodder
C-Lodder
14 Sep 2021

Steps to reproduce the issue

  1. Open modules/mod_login/mod_login.xml and add the following code:
<field
	name="colours"
	type="subform"
	formsource="modules/mod_login/colours.xml"
	layout="joomla.form.field.subform.repeatable-table"
	label="Colours"
	multiple="true"
	default='[{"colour":"#FF0000"},{"colour":"#008000"}]'
/>
  1. Create a new file (modules/mod_login/colours.xml) and add the following code:
<?xml version="1.0" encoding="UTF-8"?>
<form>
	<fieldset name="colours" label="Colours">
		<field name="colour" type="color" label="Colour" />
	</fieldset>
</form>
  1. In your Joomla administrator panel, open the Login module and you should see two default colours:
    image

  2. Delete both subform rows and click Save

Expected result

There should be NO colour fields shown.

Actual result

The field is reset back to the default values.

avatar C-Lodder C-Lodder - open - 14 Sep 2021
avatar joomla-cms-bot joomla-cms-bot - change - 14 Sep 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Sep 2021
avatar C-Lodder C-Lodder - change - 14 Sep 2021
The description was changed
avatar C-Lodder C-Lodder - edited - 14 Sep 2021
avatar C-Lodder C-Lodder - change - 14 Sep 2021
Title
[4.0] Subform resets to default when all are deleted.
[4.0] Subform resets to default when all entries are deleted
avatar C-Lodder C-Lodder - edited - 14 Sep 2021
avatar brianteeman
brianteeman - comment - 14 Sep 2021

Isn't that the same with any field that has a default value? The same is true with the template style color fields

avatar C-Lodder
C-Lodder - comment - 14 Sep 2021

When I say remove the colour entries, I dont mean from the input fields. I mean delete the actual subform row.

avatar C-Lodder C-Lodder - change - 15 Sep 2021
The description was changed
avatar C-Lodder C-Lodder - edited - 15 Sep 2021
avatar Fedik
Fedik - comment - 15 Sep 2021

It expected behavior. As @brianteeman wrote, the same happen to other fields if you remove the value. On next load it will use default. You can test it with <field type="text" name="text" default="blabla" />

I mean delete the actual subform row.

Each row is a value in subform (multiple), removing all rows means the subform is empty, and it will pick up default.

avatar C-Lodder C-Lodder - close - 15 Sep 2021
avatar C-Lodder
C-Lodder - comment - 15 Sep 2021

Cool, thanks.
Just tested with other fields and you're both right.

avatar C-Lodder C-Lodder - change - 15 Sep 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-09-15 10:39:32
Closed_By C-Lodder

Add a Comment

Login with GitHub to post a comment