magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Use system value on depends field with required value #14373

Open thomas-kl1 opened 6 years ago

thomas-kl1 commented 6 years ago

I didn't found any related issues in your backlog, if it actually already exists, my apologies.

 Unhanded event when the "Use system value" is triggered in the store configuration admin interface.

Preconditions

  1. Magento 2.4-develop
  2. Custom configuration as following (simplified) in system.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="system">
            <group id="my_custom_settings" translate="label" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>My Custom Settings</label>
                <field id="custom_field_disable" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Disable Button</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="custom_field_value" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Select Field</label>
                    <source_model>Vendor\Module\Model\Config\Source\MyOptions</source_model><!-- return empty array or first value is empty -->
                    <can_be_empty>0</can_be_empty>
                    <validate>required-entry</validate>
                    <depends>
                        <field id="custom_field_disable">0</field>
                    </depends>
                </field>
            </group>
        </section>
    </system>
</config>
  1. Default configuration values in the config.xml:
    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <system>
            <my_custom_settings>
                <custom_field_disable>1</custom_field_disable>
            </my_custom_settings>
        </system>
    </default>
    </config>

Steps to reproduce

  1. Add above content in the system.xml and config.xml of a custom module
  2. Clear the cache
  3. Go to store > config > Advanced > System > My Custom Settings
  4. Uncheck "Use system value" of the "Disable Button" field
  5. Check value "Yes"
  6. "Select Field" field appear, (do not select any value)
  7. Check "Use system value" of the "Disable Button" field

Expected result

  1. The depends fields should disappears
  2. We are able to save the config

Actual result

  1. Depends fields are still visibles
  2. Can't save because the "Select Field" is required #14373

Workaround

  1. Select manually the value of the first field
m2-assistant[bot] commented 5 years ago

Hi @vivekkumarcedcoss. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

m2-assistant[bot] commented 4 years ago

Hi @engcom-Bravo. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


m2-assistant[bot] commented 4 years ago

Hi @engcom-Delta. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


magento-engcom-team commented 4 years ago

:white_check_mark: Confirmed by @engcom-Delta Thank you for verifying the issue. Based on the provided information internal tickets MC-30283 were created

Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] commented 4 years ago

Hi @viral-wagento. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


viral-wagento commented 4 years ago

MM20IN

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!