You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#100190 Dynamically adding mediajce fields

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by kcoweb on Thursday, 27 June 2019 08:24 BST

kcoweb
Hi,

I'm tweaking j2store back-end to make it use mediajce fields in place of their monstrosity, everything kinda works except dynamically added fields (which get cloned and IDs replaced) -- the newly cloned fields don't respond to clicks. Is there a way to intialise them, or is there a "proper" way to dynamically add new mediajce fields to DOM?

Thanks

Ryan
A mediajce field is just an extension of a Joomla media field - opening the JCE File Browser instead of the Joomla Media Manager - so it behaves in the same way.
is there a "proper" way to dynamically add new mediajce fields to DOM?
Use a "subform" field, with the mediajce field as the "formsource" - https://docs.joomla.org/Subform_form_field_type For example, the formsource file could contain:

<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields>
		<field
			name="image_repeat"
			type="mediajce"
			mediatype="files"
			label=""
			description="" 
		/>
	</fields>
</form>

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

kcoweb
Thanks, that's what I ended up doing -- creating form dynamically from an xml string, injecting values and rendering.