cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Multiline component field in admin form using ui component

How to add Multiline component field in admin form using ui component

I want to add a field like Street address in my custom module. same as customer Address Add from back-end form. it will look like the below image.

Veronica Costello _ Customers _ Customers _ Magento Admin.png

 

How can I add this kind of field using the UI component?

 

I have used the below code to display a multiline component. But it is not displaying a filed label.

 

<field name="address">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string" translate="true">Magento_Ui/js/form/components/group</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="size" xsi:type="number">2</item>
                    <item name="formElement" xsi:type="string">multiline</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="source" xsi:type="string">store</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">true</item>
                    </item>
                </item>
                <item name="label" xsi:type="string" translate="true">Address</item>
            </argument>
        </field>

And also I would like to create a field using a new UI-component form code method, the above code is an older code method.

If Issue Solved, Click Kudos/Accept As solutions.
2 REPLIES 2

Re: How to add Multiline component field in admin form using ui component

I added multiline component using below code and it worked - 

<field name="address">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string" translate="true">Magento_Ui/js/form/components/group</item>
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Address</item>
<item name="size" xsi:type="number">2</item>
<item name="formElement" xsi:type="string">multiline</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="source" xsi:type="string">store</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>

 

 If Issue Solved, Click Kudos/Accept As solutions.

Re: How to add Multiline component field in admin form using ui component

Effectively oversee all facets of your team, encompassing the recruitment and cultivation of players, enhancing their statistical performance, baseball 9