https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/ui-checkbox.html
devdocs says default value is false but there is no clue how to turn it to true. Anyone know what to add in xml file to make it happen. Many thanks
https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/ui-checkbox.html
devdocs says default value is false but there is no clue how to turn it to true. Anyone know what to add in xml file to make it happen. Many thanks
You can use the following code to set the default checkbox value in ui_component
<form>
<fieldset>
<field name="myCheckbox" formElement="checkbox">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="default" xsi:type="boolean">true</item>
</item>
</argument>
<settings>
<label translate="true">Enabled</label>
<tooltip>
<description translate="true">This is my checkbox's description</description>
</tooltip>
</settings>
<formElements>
<checkbox>
<settings>
<prefer>toggle</prefer>
<valueMap>
<map name="false" xsi:type="boolean">false</map>
<map name="true" xsi:type="boolean">true</map>
</valueMap>
</settings>
</checkbox>
</formElements>
</field>
</fieldset>
Let me know if you have any other issue with the code Thanks