Magento 2 How can I add unit of the data in the ui form field?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















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>









share|improve this question































    4















    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>









    share|improve this question



























      4












      4








      4








      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>









      share|improve this question
















      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>






      magento2 price currency ui-form custom-field






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 17 '18 at 11:53









      Teja Bhagavan Kollepara

      2,99841949




      2,99841949










      asked Jan 5 '17 at 7:21









      Jancy AbrahamJancy Abraham

      1,12111638




      1,12111638






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You can add attribute "addbefore" follow 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>




          share
























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f153225%2fmagento-2-how-can-i-add-unit-of-the-data-in-the-ui-form-field%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You can add attribute "addbefore" follow 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>




            share




























              0














              You can add attribute "addbefore" follow 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>




              share


























                0












                0








                0







                You can add attribute "addbefore" follow 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>




                share













                You can add attribute "addbefore" follow 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>





                share











                share


                share










                answered 1 min ago









                the lightthe light

                465




                465






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f153225%2fmagento-2-how-can-i-add-unit-of-the-data-in-the-ui-form-field%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What other Star Trek series did the main TNG cast show up in?

                    Berlina muro

                    Berlina aerponto