<field name="country_id">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object"></item><item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Country</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">ModuleName</item>
<item name="dataScope" xsi:type="string">country_id</item>
<item name="default" xsi:type="string">10</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
2
2
<field name="country_id">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Magento\Directory\Model\Config\Source\Country</item>
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Country</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">store</item>
<item name="sortOrder" xsi:type="number">10</item>
<item name="dataScope" xsi:type="string">country_id</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/element/country</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
-
Thanks guys, I found the solution in this way, hope it will be helpful for someone – Lokesh Das May 31 '18 at 12:23
0
Please follow below codes
<field name="manage_stock">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Manage Stock</item>
<item name="formElement" xsi:type="string">select</item>
<item name="rawOptions" xsi:type="boolean">true</item>
<item name="dataScope" xsi:type="string">manage_stock</item>
<item name="scopeLabel" xsi:type="string">[GLOBAL]</item>
<item name="value" xsi:type="object">Magento\CatalogInventory\Model\Source\StockConfiguration</item>
</item>
<item name="options" xsi:type="object">Magento\Config\Model\Config\Source\Yesno</item>
</argument>
</field>
Let me know if face issue
-
Thanks guys, I found the solution in this way, hope it will be helpful for someone – Lokesh Das May 31 '18 at 12:22
-
0
<field name="country_id" formElement="select">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">country_id</item>
</item>
</argument>
<settings>
<visible>false</visible>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Country</label>
</settings>
<formElements>
<select>
<settings>
<options class="Magento\Directory\Model\ResourceModel\Country\Collection"/>
</settings>
</select>
</formElements>
</field>