美文网首页
How to set default value for tex

How to set default value for tex

作者: 葡萄月令 | 来源:发表于2018-05-20 13:48 被阅读10次

    How to set default value for text and select field in admin new UI form in magento 2

    You need to add below code:

    <item name="default" xsi:type="string">1</item>
    

    Example:

    <field name="price">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Price</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="dataType" xsi:type="string">text</item>
                <item name="formElement" xsi:type="string">input</item>
                <item name="source" xsi:type="string">product_information</item>
                <item name="dataScope" xsi:type="string">price</item>
                <item name="default" xsi:type="string">0</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
                    <item name="validate-number" xsi:type="boolean">true</item>
                </item>
            </item>
        </argument>
    </field>
    

    Tony's blog image

    More Information, Please Subscribe My Wechat Public Platform Or View My Blog : https://www.abmbio.xin

    20180117_81914.jpg

    相关文章

      网友评论

          本文标题:How to set default value for tex

          本文链接:https://www.haomeiwen.com/subject/swftjftx.html