0

I would like to add form same as like admin customer edit Add new address form. So i have added InsertForm component inside the customer edit form using this reference link

A form is displaying fine but save, cancel and back button are not displaying in form

can anybody have idea why button is not displaying in form.

0

The documentation regarding the InsertForm component is somewhat lacking. To display the inserted forms buttons, use mui/index/render_handle rather than mui/index/render for the <renderUrl> param.

Here's an example that I have recently used.

<!-- component is not required. this form was very similar and benefits from the customer insert-form -->
    <insertForm name="update_contact_address_form_loader" component="Magento_Customer/js/form/components/insert-form">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <!-- The name of the inserted forms data provider : the first half of the inserted forms provider param -->
                <item name="addressListingProvider" xsi:type="string">ns = example_contacts_addresses_listing, index = example_contacts_addresses_listing</item>
                <!-- parentName (if using modal) -->
                <item name="addressModalProvider" xsi:type="string">${ $.parentName }</item>
            </item>
        </argument>
        <settings>
            <formSubmitType>ajax</formSubmitType>
            <!-- note the renderUrl is 'render_handle' rather than just 'render' this is required for rendering buttons -->
            <renderUrl path="mui/index/render_handle">
                <!-- The handle name is the same as the layout name. Example: view/adminhtml/layout/example_contacts_addresses_edit.xml -->
                <param name="handle">example_contacts_addresses_edit</param>
                <!-- show buttons from inserted form -->
                <param name="buttons">1</param>
            </renderUrl>
            <loading>false</loading>
            <toolbarContainer>${ $.parentName }</toolbarContainer>
            <!-- The data provider of the inserted form : the second half of the inserted forms provider param -->
            <externalProvider>${ $.ns }.addresses_form_data_source</externalProvider>
            <!-- The name of the inserted ui component form -->
            <ns>example_contacts_addresses_form</ns>
            <exports>
                <!-- for this particular form, parent_id is a foreign key that references the entity_id of the contact -->
                <link name="parentId">${ $.externalProvider }:data.parent_id</link>
            </exports>
            <imports>
                <link name="parentId">${ $.provider}:data.entity_id</link>
            </imports>
        </settings>
    </insertForm>

Magento's Customer Module is a helpful resource. Check out the customer_form.xml for

1
  • how can I add required to InsertForm component ?
    – huykon225
    Dec 30 '20 at 6:45

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.