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"}]'
/>
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>
In your Joomla administrator panel, open the Login module and you should see two default colours:
Delete both subform rows and click Save
There should be NO colour fields shown.
The field is reset back to the default values.
Labels |
Added:
No Code Attached Yet
|
Title |
|
When I say remove the colour entries, I dont mean from the input fields. I mean delete the actual subform row.
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.
Cool, thanks.
Just tested with other fields and you're both right.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-09-15 10:39:32 |
Closed_By | ⇒ | C-Lodder |
Isn't that the same with any field that has a default value? The same is true with the template style color fields