Skip to content

Subform-repeatable javascript #39964

@brianteeman

Description

@brianteeman

Steps to reproduce the issue

Create a repeatable subform that contains a field that uses js

You can add this code to mod_article_categories.xml as a test

<field
	name="field-name"
	type="subform"
	label="Subform Field"
	multiple="true"
	min="1"
	max="10"
	>
	<form>
		<fieldset name="basic" addfieldprefix="Joomla\Component\Categories\Administrator\Field">
			<field
				name="parent"
				type="modal_category"
				label="MOD_ARTICLES_CATEGORIES_FIELD_PARENT_LABEL"
				extension="com_content"
				filter="integer"
				published=""
				select="true"
				new="true"
				edit="true"
				clear="true"
			/>
		</fieldset>
	</form>
</field>

Expected result

A working repeatable field to select the category

Actual result

Only the first occurence works. All subsequent fields do not as the modal is empty

Additional comments

I understand that this is because the modal_category field uses javascript to populate the iframe in the body of the modal but as it does this on page load it does not work for the repeated field because it is not present on page load.

I assume that there could be some javascript that could be instantiated when a subform row is added that would populate the field as required. But I don't have a clue with js to know where to start

cc @Fedik @dgrammatiko

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions