In Joomla 4.1.2 all the bug width Subform.
Including a form field in the (content) plugin:
public function onContentPrepareForm(Form $form, $data)
{
...
$form->load('
<form>
<field
name="fulltextTTT"
type="subform"
label="FIELD_SITE_VIDEO_YOUTUBE_QUEST"
multiple="true"
min="1"
max="444"
buttons="add,remove"
layout="joomla.form.field.subform.repeatable"
>
<form>
<field
name="quest"
type="text"
label="Тут текст метки quest"
filter="JComponentHelper::filterText"
/>
<field
name="responses"
type="subform"
label="FIELD_SITE_VIDEO_YOUTUBE_ANSWERS"
multiple="true"
min="2"
max="444"
buttons="add,remove"
layout="joomla.form.field.subform.repeatable-table"
>
<form>
<field
name="answer"
type="text"
label="Тут текст метки answer"
filter="JComponentHelper::filterText"
/>
</form>
</field>
</form>
</field>
</form>'
);
...
Inserting a form field in a template:
templates\my-template\html\com_content\form\layer-name.php
...
<?php /* вставка поля с Викториной */ ?>
<?php echo $this->form->renderField('fulltextTTT'); ?>
<?php /* конец вставки поля с Викториной */ ?>
Received data:
Array
(
[fulltextTTT0] => Array
(
[quest] => quest 1
[responses] => Array
(
[responses0] => Array
(
[answer] => answer 1/1
)
[responses1] => Array
(
[answer] => answer 1/2
)
)
)
[fulltextTTT1] => Array
(
[quest] => quest 2
[responses] => Array
(
)
)
[fulltextTTTX] => Array
(
[responses] => Array
(
[responses0] => Array
(
[answer] => answer 2/1
)
[responses1] => Array
(
[answer] => answer 2/2
)
)
)
)
Data that must be sent by the form::
Array
(
[fulltextTTT0] => Array
(
[quest] => quest 1
[responses] => Array
(
[responses0] => Array
(
[answer] => answer 1/1
)
[responses1] => Array
(
[answer] => answer 1/2
)
)
)
[fulltextTTT1] => Array
(
[quest] => quest 2
[responses] => Array
(
[responses0] => Array
(
[answer] => answer 2/1
)
[responses1] => Array
(
[answer] => answer 2/2
)
)
)
)
PHP Built On Linux lb8 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64
Database Type mysql
Database Version 10.3.34-MariaDB-0+deb10u1
Database Collation utf8mb4_general_ci
Database Connection Collation utf8mb4_general_ci
Database Connection Encryption None
Database Server Supports Connection Encryption No
PHP Version 8.0.18
Web Server nginx/1.21.6
WebServer to PHP Interface fpm-fcgi
Joomla! Version Joomla! 4.1.2 Stable [ Kuamini ] 30-March-2022 16:00 GMT
Labels |
Added:
No Code Attached Yet
|
Title |
|
Title |
|
Upgrade to Joomla Joomla 4.1.3.
Subforms error has not been fixed.
The error is localized.
The problem is that when the second nested field template is created, the minimum number of nested fields is specified.
Here it is:
<field
name="responses"
type="subform"
label="FIELD_SITE_VIDEO_YOUTUBE_ANSWERS"
multiple="true"
min="2" <!------------------------------------- It's not working! -->
max="444"
buttons="add,remove"
layout="joomla.form.field.subform.repeatable-table"
>
Labels |
Added:
bug
|
PHP Version 7.4.29
Doesn't work correctly either.