This is a beta release of documentation for Magento 2.4, published for previewing soon-to-be-released functionality. Content in this version is subject to change. Links to the v2.4 code base may not properly resolve until the code is officially released.

FormDataProvider component

The FormDataProvider UI component is a data provider for the Form component. It stores form data in a specific format that is shared among all UI components in the scope of Form component and provides the functionality for submitting the data.

Configuration options

Option Description Type Default Value
class Path to the PHP class responsible for the backend implementation of the component String Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider
component The path to the component’s .js file, relative to RequireJS. String Magento_Ui/js/form/provider
clientConfig Configuration of the FormClient component. Object urls: {save: '${ $.submit_url }',beforeSave: '${ $.validate_url }'}
submit_url Path to controller that will process the form data submitting request. String -
validate_url Path to controller that will process the form data validation request. String -

Sources files

Extends UiElement:

Examples

Integrate the FormDataProvider component with the Form component

This is an example of how the FormDataProvider component integrates with the Form component:

1
2
3
4
5
6
7
8
9
10
11
12
13
<form>
    <dataSource name="sales_rule_form_data_source">
        <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
            </item>
        </argument>
        <settings>
            <submitUrl path="path/to/submit_form_data_controller"/>
            <validateUrl path="path/to/validate_form_data_controller"/>
        </settings>
    </dataSource>
</form>