Question

In Magento2 admin configuration we can display field conditionally like below,

<field id="do_3Dsecure" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Activate 3DS Authentication</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>

<field id="enable_dynamic3DS2" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable 3DS2 Authentication</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends><field id="do_3Dsecure">1</field></depends>
</field>

It is Yes/No (1/0) and it is working fine with depends node. But in my case that dependant field is having text value, like below

 <field id="integration_mode" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Integration Mode</label>
                    <source_model>Mymodule\Test\Worldpay\Model\Config\Source\IntegrationMode</source_model>
                </field>

it is a dropdown field and it contains below below values

  1. direct
  2. redirect

So, is there any possible to display field based on this above text value by using depends node ?

Was it helpful?

Solution

Try this:

<depends><field id="integration_mode">direct</field></depends>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top