Skip to content

How can I set the value of a Yes/No Config field based on the value selected in another yes/no field in Magento 2 system.xml

I have a system.xml which has 2 yes/no fields.

<field id="popup" translate="label" type="select" sortOrder="1" >
    <label>Pop Up</label>
    <source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="embed" translate="label" type="select" sortOrder=“2” >
    <label>Embed</label>
    <source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>

If popup is set to yes I want to automatically set embed to no and if if embed is set to yes set popup to no.

Is it possible to do this?