Anil Makwana
Anil Makwana

Reputation: 1

Magento 2 : Different section dependency not working in system.xml

I'm using magento 2.4.3 In system configuration, I want to do apply dependency.

But, both Section and fields are different. It's working in same Section. But, I can't get output for different Section.

How to do it ? Please help me.

I added my system.xml file code :

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/system_file.xsd">
  <system>
        <section id="SectionID1" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="GroupID1" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>API Gateway</label>
                <field id="FieldID1" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Name</label>
                    <source_model>Vendor\Module_Name\Model\Config\Gateways</source_model>
                    <config_path>SectionID1/GroupID1/FieldID1</config_path>
                </field>
           </group>
        </section>  
        <section id="SectionID2" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
            <group id="GroupID2" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <field id="FieldID2" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
             <field id="FieldID3" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Name_Test</label>
                    <depends>
                        <field id="FieldID2">1</field>          
                        <field id="SectionID1/GroupID1/FieldID1">Value</field>
                    </depends>
                </field>
            </group>
        </section>  
  </system>
</config>       

Upvotes: 0

Views: 649

Answers (0)

Related Questions