6

I have text field in Ui form

<field name="view">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="sortOrder" xsi:type="number">140</item>
            <item name="dataType" xsi:type="string">text</item>
            <item name="label" translate="true" xsi:type="string">View</item>
            <item name="formElement" xsi:type="string">input</item>
            <item name="source" xsi:type="string">popup</item>
            <item name="dataScope" xsi:type="string">view</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">false</item>
            </item>
        </item>
    </argument>
</field>

It's shows like this but I want only label instead of textbox

enter image description here

2
  • <item name="dataType" xsi:type="string">label</item> ? Commented Apr 19, 2017 at 6:25
  • 1
    @AnkitShah I already tried this but it's not working. Commented Apr 19, 2017 at 6:37

2 Answers 2

5

Can't find answer for this anywhere, so will leave my solution on this old thread:

<field formElement="input" name="field_name">
    <settings>
        <label translate="true">Field label</label>
        <dataScope>field name</dataScope>
        <elementTmpl>ui/form/element/text</elementTmpl>
    </settings>
</field>
1
  • This approach is actually simple and elegant. Works as expected as well. Commented Dec 16, 2020 at 0:58
0

Use Input type "text" with read-only : true and with CSS hide the borders. This is uggly but works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.