Skip to content

Multiple (child) XML ui_component forms on same page, Controller post data

Is there a way to have child ui_component forms inside a parent ui_component form?

Doing this in a layout file creates 3x seperate forms on the same page (these forms display on the same page already)

<body>
    <referenceContainer name="content">
        <uiComponent name="vendor_mymodule_account_application_form"/>
    </referenceContainer>
</body>
<update handle="vendor_mymodule_accountapplicationcompanyinfo_edit" />
<update handle="vendor_mymodule_accountapplicationcontactinfo_edit" />

The above means only the main form vendor_mymodule_account_application_form content gets posted.

In other words on the controller Save.php::execute(), only receives the main form data:

$this->getRequest()->getPostValue();

// returns
trade_account_application_state_type_id:
""
form_key:
"NAeq4FpF423asskhA0Jst"

Extra information

vendor_mymodule_accountapplicationcompanyinfo_edit
vendor_mymodule_accountapplicationcontactinfo_edit

The above files are layout xml files with the following content:

<update handle="styles"/>
<body>
    <referenceContainer name="content">
        <uiComponent name="vendor_mymodule_account_application_contactinfo_form"/>
    </referenceContainer>
</body>

<update handle="styles"/>
<body>
    <referenceContainer name="content">
        <uiComponent name="vendor_mymodule_account_application_companyinfo_form"/>
    </referenceContainer>
</body>

Question

How do I combine these <uiComponent /> entities into one form by inserting the seperate <uiComponent /> somewhere?

  • I need all the data inside the controller to be received such that $this->getRequest()->getPostValue(); can get all forms content together.

I want these uiComponent entities to be separate, because the form contents are working on their own, but I want to now use it on the same Controller Save::execute()