2

I am trying to use the new subform feature to implement nested forms. This greatly increases the readability for developers and I thought it was already possible to do but after testing I am not so sure anymore. So I tried it out and see that while the nested forms are displayed the values are not saved. Here are the codes that are related.

mod_something.xml (repeatable)

            <field name="levelone" type="subform"
              formsource="/modules/mod_something/models/forms/levelone.xml"
              min="1"
              max="9999999999"
              multiple="true"
              layout="joomla.form.field.subform.repeatable"
              groupByFieldset="false"
              buttons=""
              label="Level 1"
              description="" />

levelone.xml

            <field name="leveltwo" type="subform"
              formsource="/modules/mod_something/models/forms/leveltwo.xml"
              min="1"
              max="9999999999"
              multiple="false"
              layout="joomla.form.field.subform.default"
              groupByFieldset="false"
              buttons=""
              label="Level 2"
              description="" />

leveltwo.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <form>
                <field
                    name="test"
                    type="text"
                    default=""
                    label="Test"
                    size="10"
                />
            </form>

Now this seems a bit strange but this is merely build for the purpose of creating a future template to use.

So as I said the field name test shows up nicely but it does not save the input. When I move this field to the levelone.xml (so one level higher) then it does save.

Hopefully anyone knows how to make it save.

Thanks to everyone for helping!

1

So far this is not yet possible to do in Joomla. Nested subforms or in other words multi level subforms is on the agenda. It's just hoping a good volunteer is ready to tacke this issue.

More info can be found here: https://github.com/joomla/joomla-cms/issues/11551

In the meanwhile the only possible solution is to add your own javascript and copy the values from every input/select field that you added into the deep levels and make them save on the base level. While in theory this would work in reality it will be a absolute hell to manage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.