Create a module with a subform field, which has a nested subform field. Everything loads fine. Add a row and fill in all required fields then save the module. You will be presented with a validation error that the first item which is a required field gives an error that it's required, even though it was completed. Then review the rows and notice an additional empty row has been added and that's what's creating the error.
Remove the additional empty row and the form saves successfully.
The form with subform fields is saved successfully provided all required fields are completed.
On save there is an additional row created before validation, which gives a validation error for required fields. Once removed the form is saved successfully.
PHP Built On Linux uk 4.18.0-513.18.1.el8_9.cloud.0.4.x86_64 #1 SMP Thu Mar 7 19:21:59 UTC 2024 x86_64
Database Type mysql
Database Version 8.0.37
Database Collation latin1_swedish_ci
Database Connection Collation utf8mb4_0900_ai_ci
Database Connection Encryption None
Database Server Supports Connection Encryption Yes
PHP Version 8.1.29
Web Server Apache
WebServer to PHP Interface fpm-fcgi
Joomla! Version Joomla! 5.1.0 Stable [ Kudumisha ] 16-April-2024 16:00 GMT
Joomla Backward Compatibility Plugin Enabled ()
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
Information Required
|
Please provide an example form for the subform field.
Module XML File:
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
<name>mod_adonis_fixtures</name>
<author>Adonis Media</author>
<creationDate>July 2022</creationDate>
<copyright>(C) 2010-2022 Adonis Media, All Rights Reserved</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>support@adonis.media</authorEmail>
<authorUrl>www.adonis.media</authorUrl>
<version>1.0.0</version>
<description>MOD_ADONIS_FIXTURES_XML_DESCRIPTION</description>
<customContent/>
<files>
<filename module="mod_adonis_fixtures">mod_adonis_fixtures.php</filename>
<folder>tmpl</folder>
</files>
<languages folder="language">
<language tag="en-GB">en-GB.mod_adonis_fixtures.ini</language>
<language tag="en-GB">en-GB.mod_adonis_fixtures.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ADONIS_FIXTURES_HTML"/>
<config>
<fields name="params">
<fieldset name="fixtures" label="MOD_FIXTURES_FIELDSET_LABEL">
<field
name="show_next_match_section"
type="radio"
label="MOD_ADONIS_FIXTURES_FIELD_SHOW_NEXT_MATCH_SECTION_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_SHOW_NEXT_MATCH_SECTION_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_future_match_section"
type="radio"
label="MOD_ADONIS_FIXTURES_FIELD_SHOW_FUTURE_MATCH_SECTION_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_SHOW_FUTURE_MATCH_SECTION_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="hide_name_mobile"
type="radio"
label="MOD_ADONIS_FIXTURES_FIELD_HIDE_NAME_MOBILE_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_HIDE_NAME_MOBILE_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_short_name_mobile"
type="radio"
label="MOD_ADONIS_FIXTURES_FIELD_SHOW_SHORT_NAME_MOBILE_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_SHOW_SHORT_NAME_MOBILE_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="next_match_wrapper_class"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_WRAPPER_CLASS_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_WRAPPER_CLASS_DESC"
/>
<field
name="next_match_header"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_HEADER_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_HEADER_DESC"
default="Next Match"
/>
<field
label="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_BANNER_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_BANNER_DESC"
name="next_match_banner"
type="media"
preview="true"
/>
<field
name="next_match_banner_alt"
type="text"
default="Next Match"
label="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_BANNER_ALT_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_EXT_MATCH_BANNER_ALT_DESC"
/>
<field
name="next_match_link"
type="url"
default=""
label="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_LINK_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_LINK_DESC"
/>
<field
name="next_match_link_class"
type="text"
default=""
label="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_LINK_CLASS_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_LINK_CLASS_DESC"
/>
<field
name="next_match_link_new_window"
type="radio"
label="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_LINK_NEW_WINDOW_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_NEXT_MATCH_LINK_NEW_WINDOW_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="future_match_header"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_FUTURE_MATCH_HEADER_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_FUTURE_MATCH_HEADER_DESC"
default=""
/>
<field
name="fixtures"
type="subform"
formsource="modules/mod_adonis_fixtures/forms/fixture.xml"
multiple="true"
required="true"
label="MOD_ADONIS_FIXTURES_FIELD_FIXTURES_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_FIXTURES_DESC"
/>
</fieldset>
<fieldset name="options" label="COM_MODULES_BASIC_FIELDSET_LABEL">
<field
name="prepare_content"
type="radio"
label="MOD_ADONIS_FIXTURES_FIELD_PREPARE_CONTENT_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_PREPARE_CONTENT_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="background-image"
type="media"
label="MOD_ADONIS_FIXTURES_FIELD_BACKGROUND_IMAGE_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_BACKGROUND_IMAGE_DESC"
/>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC"
validate="moduleLayout"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="cache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC"
default="1"
filter="integer"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC"
default="900"
filter="integer"
/>
<field
name="cachemode"
type="hidden"
default="static"
>
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
</extension>
First Subform:
<?xml version="1.0" encoding="UTF-8"?>
<form>
<field
name="league"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_LEAGUE_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_LEAGUE_DESC"
required="true"
/>
<field
name="date"
type="calendar"
default="now + 1 week"
label="MOD_ADONIS_FIXTURES_FIELD_DATE_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_DATE_DESC"
required="true"
filter="user_utc"
showtime="true"
format="%Y-%m-%d %H:%M"
todaybutton="false"
filltable="false"
translateformat="true"
/>
<field
name="location"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_LOCATION_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_LOCATION_DESC"
required="true"
/>
<field
name="link"
type="url"
default=""
label="MOD_ADONIS_FIXTURES_FIELD_LINK_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_LINK_DESC"
/>
<field
name="link_text"
type="text"
default="More Details"
label="MOD_ADONIS_FIXTURES_FIELD_LINK_TEXT_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_LINK_TEXT_DESC"
/>
<field
name="link_class"
type="text"
default=""
label="MOD_ADONIS_FIXTURES_FIELD_LINK_CLASS_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_LINK_CLASS_DESC"
/>
<field
name="link_new_window"
type="radio"
label="MOD_ADONIS_FIXTURES_FIELD_LINK_NEW_WINDOW_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_LINK_NEW_WINDOW_DESC"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="teams"
type="subform"
multiple="true"
buttons="move"
label="MOD_ADONIS_FIXTURES_FIELD_TEAMS_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_TEAMS_DESC"
max="2"
min="2"
formsource="modules/mod_adonis_fixtures/forms/team.xml"
/>
</form>
Child Subform:
<?xml version="1.0" encoding="UTF-8"?>
<form>
<field
name="result"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_TEAM_RESULT_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_TEAM_RESULT_DESC"
/>
<field
name="team_name"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_TEAM_NAME_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_TEAM_NAME_DESC"
required="true"
/>
<field
name="team_short_name"
type="text"
label="MOD_ADONIS_FIXTURES_FIELD_TEAM_SHORT_NAME_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_TEAM_SHORT_NAME_DESC"
/>
<field
label="MOD_ADONIS_FIXTURES_FIELD_TEAM_LOGO_LABEL"
description="MOD_ADONIS_FIXTURES_FIELD_TEAM_LOGO_DESC"
name="team_logo"
type="media"
preview="true"
directory="teamlogos"
/>
</form>
Labels |
Added:
bug
Removed: Information Required |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-06-22 08:09:16 |
Closed_By | ⇒ | Fedik |
Thanks, Remove
min
attribute forteams
subform, and it will work. It is known bug, you can follow #43652 I close current issue as duplicate.
Hi @Fedik
It seems when I remove the min attribute the subform doesn't load the child form, the field is there but the form does not load. Adding min back shows the form.
Any ideas when this will be resolved?
I see you have only buttons="move"
buttons, that can explain it.
Try with add
button, I know it maybe not exactly what you want, but as long as you have max=2
it should be very close to what you wanted.
Any ideas when this will be resolved?
No idea. It is only affect nested subforms, regular subform works fine.
Btw, another thing to try, is to add min="1"
to the root subform, in theory then min="2"
in the nested subform will work.
But need to test, just theory.
Please provide an example form for the subform field.