No Code Attached Yet
avatar dawe78
dawe78
18 Apr 2024

Steps to reproduce the issue

  • create a test view
  • create forms (see attached txt-files)
  • preset data in test model:
protected function loadFormData()	{
    $data = new \stdClass();
    $data->title = "Test entry";
    $data->subform = array();
		
    $subItem = new \stdClass();
    $subItem->id = 2;
    $subItem->listfield = array(2,3);
    $subItem->date_1 = mktime(0,0,0,11,10,2019);
    $subItem->date_2 = mktime(0,0,0,11,15,2019);
    $data->subform[] = $subItem;

    $subItem = new \stdClass();
    $subItem->id = 3;
    $subItem->listfield = array(1,3);
    $subItem->date_1 = mktime(0,0,0,11,10,2020);
    $subItem->date_2 = mktime(0,0,0,11,15,2020);
    $data->subform[] = $subItem;
    return $data;
}
  • call view in backend

Expected result

Form fields are rendered with loaded data

Actual result

Form fields (calendar) are all set to current date; only loaded once per fieldname, not per subform element

System information (as much as possible)

Ubuntu 22.04
Apache 2 Webserver
PHP 8.3
Joomla 5.1.0

Additional comments

If I comment out line 1353 in /libraries/src/Form/FormField.php (do not used previous stored layoutData), eg.

if ($this->layoutData) {
//return $this->layoutData;
}

forms fields are loaded as expected.

avatar dawe78 dawe78 - open - 18 Apr 2024
avatar dawe78 dawe78 - change - 18 Apr 2024
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 18 Apr 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 18 Apr 2024
avatar dawe78
dawe78 - comment - 18 Apr 2024

I could not upload these files, so I put it here:

Main form:

<?xml version="1.0" encoding="UTF-8"?>
<form>
    <fieldset name="general">
        <field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
        <field name="title"  type="text" required="true" label="Test" description=""/>
	<field name="subform" type="subform" clayout="joomla.form.field.subform.repeatable-table" formsource="path_to_subform/subform_test.xml" multiple="true" label="Subform" description="" />
    </fieldset>
</form>

Subform:

<?xml version="1.0" encoding="UTF-8"?>
<form>
    <fieldset name="general">
        <field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
        <field name="listfield" layout="joomla.form.field.list-fancy-select" type="list" required="true" label="List" description="" multiple="1">
		<option value="1">option 1</option>
		<option value="2">option 2</option>
		<option value="3">option 3</option>
        </field>
        <field name="date_1" type="calendar" required="1" label="date 1" description=""/>
        <field name="date_2" type="calendar" required="1" label="date 2" description=""/>
    </fieldset>
</form>
```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/43303">issues.joomla.org/tracker/joomla-cms/43303</a>.</sub>
avatar brianteeman
brianteeman - comment - 18 Apr 2024

type="subform" clayout=

is that a typo?

avatar dawe78
dawe78 - comment - 18 Apr 2024

Edit: this issue seems to match only for table-subforms, layout joomla.form.field.subform.repeatable-table. If default layout is set (I disabled by adding c before layout as in above example) everything works fine.

So two edits for example:

avatar Fedik Fedik - change - 18 Apr 2024
The description was changed
avatar Fedik Fedik - edited - 18 Apr 2024
avatar Fedik
Fedik - comment - 18 Apr 2024

Ah, I get it, it nothing to do with subform.
It a bug in calendar field, the fix is there #43234
Please test it to be sure.

Thanks.

avatar dawe78
dawe78 - comment - 18 Apr 2024

@Fedik fix checked, works, thanks!


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

avatar Fedik Fedik - change - 18 Apr 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-04-18 14:56:06
Closed_By Fedik
avatar Fedik Fedik - close - 18 Apr 2024

Add a Comment

Login with GitHub to post a comment