I have the basic xml file where in I call subforms into two tabs. Called Tab 1 and Tab 2. The content of this file is below.
mod_something.xml
<fieldset name="tab1">
<field name="storymaker" type="subform"
formsource="/modules/mod_something/models/forms/storymaker.xml"
min="1"
max="9999999999"
multiple="true"
layout="joomla.form.field.subform.repeatable-table"
groupByFieldset="false"
buttons=""
label="MOD_SOMETHING_-STORYMAKER-_LABEL"
description="MOD_SOMETHING_-STORYMAKER-_DESC" />
</fieldset>
<fieldset name="tab2">
<field name="characters" type="subform"
formsource="/modules/mod_something/models/forms/characters.xml"
min="1"
max="9999999999"
multiple="true"
layout="joomla.form.field.subform.repeatable-table"
groupByFieldset="false"
buttons=""
label="MOD_SOMETHING_-CHARACTERS-_LABEL"
description="MOD_SOMETHING_-CHARACTERS-_DESC" />
</fieldset>
Now in the form that is loaded into tab1 I have this content.
storymaker.xml
<?xml version="1.0" encoding="UTF-8"?>
<form>
<field name="characterselection" label="" type="characterselection"/>
</form>
the form in tab 2 consists out of this:
characters.xml
<?xml version="1.0" encoding="UTF-8"?>
<form>
<field
name="character_name"
type="text"
default=""
label="MOD_SOMETHING_-CHARACTERNAME-_LABEL"
description="MOD_SOMETHING_-CHARACTERNAME-_DESC"
size="10"
/>
</form>
In tab 1 I use a custom field this custom field is build up like this:
<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.formfield');
$document = JFactory::getDocument();
$jinput = JFactory::getApplication()->input;
$characters = $params->get('characters');
//$characters1 = $jinput->json->get('characters');
//$characters2 = $jinput->get('characters', null, null);
//$characters3 = $jinput->get->get('characters', NULL, NULL);
//$characters4 = $jinput->post->get('characters', NULL, NULL);
//$characters5 = $jinput->server->get('characters', NULL, NULL);
class JFormFieldCharacterSelection extends JFormField {
protected $type = 'characterselection';
public function getInput() {
foreach ($characters as $character) {
$character[] = $row->character_name;
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getInput(), $character);
return $options;
}
}
I have already tried everything I could think off but to no good. So here I am asking for your help.
what do I want to achieve
A) In tab2 I have a list of names created via a repeatable subform so that it can be 10 names or a 1000.
B) In tab1 I have another repeatable subform wherein I want to display a dropdown generated from the names given in tab2.
C) Then I want to show these names on the frontend via the normal foreach used for the subforms.
$storymaker = $params->get('storymaker');
foreach ($storymaker as $sm) :
echo $sm->characterselection . ' ';
echo '<br><br>';
endforeach;
what have I achieved so far
Sadly I only have achieved A. So I need help with B and I think that if that works C goes automatically alright but if not I might need help with that as well.
what have I tried so far
I tried every single thing I could find on the internet about subforms and using parameters from a module inside a module. You can see parts of this left in the above code (commented).
sorry for not being able to give short pinpointed code.
I had to put up all the files that are related to my problem otherwise I think no one would be able to understand what I am talking about. But sorry for the long text and code pieces.