6

I need to indicate the user that the “unit” of the data to be input, such as currency.

enter image description here

I am using ui component form. How can I achieve it?

Here is my code

<field name="total">
     <argument name="data" xsi:type="array">
         <item name="config" xsi:type="array">
             <item name="label" xsi:type="string">Amount</item>
             <item name="visible" xsi:type="boolean">true</item>
             <item name="dataType" xsi:type="string">text</item>
             <item name="disabled" xsi:type="boolean">true</item>
             <item name="formElement" xsi:type="string">input</item>
             <item name="source" xsi:type="string">total</item>
             <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
             </item>
         </item>
     </argument>
 </field>

1 Answer 1

3

You can add "addbefore" attribute to your UI component form field.
Follow this code:

<field name="xxxxx"  sortOrder="50" >
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">text</item>
                <item name="label" xsi:type="string" translate="true">xxxxx xxxxx</item>
                <item name="formElement" xsi:type="string">input</item>
                <item name="source" xsi:type="string">ordercombine</item>
                <item name="dataScope" xsi:type="string">xxxxx</item>
                <item name="default" xsi:type="string">1</item>
                <item name="addbefore" xsi:type="string">$</item>
            </item>
        </argument>
    </field>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.