No Code Attached Yet bug
avatar LukasHH
LukasHH
1 Dec 2023

Steps to reproduce the issue

I have created a module with a nested subform in the XML config.

When a new row of the subform is added, a JS error is displayed in the console. A line is added. When saving the module, another empty row is added.
image

My nested-subform for test in the config xml

<fieldset name="test_subform">
	<field
		name="mysubform"
		type="subform"
		label="My Subform"
		description="Subform Field Description"
		layout="joomla.form.field.subform.repeatable"
		multiple="true"
	>
		<form>
			<field
				name="special_day"
				type="calendar"
				filter="server_utc"
				class="input-small"
				showtime="false"
				translateformat="true"
				label="SELECT_DATE" 
				description=""
				required="true"
			/>						
			<field
				name="is_open" 
				type="radio"  
				filter="integer" 
				class="btn-group btn-group-yesno" 
				default="1" 
				label="open/close"
			>
				<option value="0">CLOSE</option>
				<option value="1">OPEN</option>
			</field>
			<field
				name="times"
				type="subform"
				label="times"
				showon="is_open:1"
				layout="joomla.form.field.subform.repeatable-table"
			>
				<form>
					<field name="time1_from" type="text" default="09:00" size="10" maxlength="7" label="TIME_1_FROM" />
					<field name="time1_to" type="text" default="18:00" size="10" maxlength="7" label="TIME_1_TO" />
					<field name="time2_from" type="text" size="10" maxlength="7" label="TIME_2_FROM" />
					<field name="time2_to" type="text" size="10" maxlength="7" label="TIME_2_TO" />	
				</form>
			</field>
		</form>
	</field>
</fieldset>

Expected result

  • when save the config, without empty row
  • without JS error

Actual result

  • An empty line is automatically added when the configuration is saved.
  • The first Required field outputs an error message because the empty field has not been filled in.
  • The user must first delete the empty field and then save it again.

JS Error:
Uncaught Error: The row template is required for the subform element to work
image

System information (as much as possible)

Joomla 4.4.0.
PHP: 8.1

Additional comments

I have found older, already closed Issius on the same topic:

avatar LukasHH LukasHH - open - 1 Dec 2023
avatar joomla-cms-bot joomla-cms-bot - change - 1 Dec 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 Dec 2023
avatar Fedik Fedik - change - 1 Dec 2023
The description was changed
avatar Fedik Fedik - edited - 1 Dec 2023
avatar Fedik Fedik - change - 1 Dec 2023
Labels Added: bug
avatar Fedik Fedik - labeled - 1 Dec 2023
avatar Fedik
Fedik - comment - 2 Dec 2023

It something to do with layout="joomla.form.field.subform.repeatable-table" for nested subform.
For now you can use the default "non table" layout, it works with it.

avatar Fedik Fedik - change - 2 Dec 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-12-02 08:49:05
Closed_By Fedik
avatar Fedik Fedik - close - 2 Dec 2023
avatar Fedik
Fedik - comment - 2 Dec 2023

Okay, it not a bug, you forgot multiple="true" for your field name="times"

Add a Comment

Login with GitHub to post a comment