0

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 ?

1

Try this:

<depends><field id="integration_mode">direct</field></depends>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.