Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget parameter depends does not work on specified block #6868

Closed
LordHansolo opened this issue Oct 4, 2016 · 12 comments · Fixed by #30570
Closed

Widget parameter depends does not work on specified block #6868

LordHansolo opened this issue Oct 4, 2016 · 12 comments · Fixed by #30570
Labels
bug report Component: Cms Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@LordHansolo
Copy link

LordHansolo commented Oct 4, 2016

Preconditions

  1. Magento 2.1.1

Steps to reproduce

  1. Create Module adding Custom Widget
  2. Add Parameter like <parameter name="catalog_url" xsi:type="block" visible="true" required="true" sort_order="33"> <label translate="true">Category</label> <depends> <parameter name="enable_url" value="1" /> <parameter name="target_url" value="1" /> </depends> <block class="Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser"> <data> <item name="button" xsi:type="array"> <item name="open" xsi:type="string" translate="true">Select Category...</item> </item> </data> </block> </parameter>
    parameter_depends
    It is important to use block class="Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser" or block class="Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser".
  3. Set any custom depends.
  4. Go to admin panel. Add your widget. In widget options change parameter that our parameter depends on.

Expected result

Our Parameter disappears, if conditions set on depends are not met.

Actual result

Parameter is visible anyway.

@biolauri
Copy link

It's also an issue in Magento 2.1.2. And, in my opinion, it is not important which block class you use, as this is a general issue with all parameters of xsi:type="block" depending on another parameter.

In #5443, you find detailed info of the expected/actual for the problem (display:none; is set on the wrong html element). I can confirm that these are the same for this one!
Maybe, this is a duplicate of #5443 (but the steps to reproduce are a bit different).

@magento-engcom-team magento-engcom-team added bug report Component: Cms Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 17, 2017
@magento-engcom-team magento-engcom-team self-assigned this Oct 17, 2017
@magento-engcom-team
Copy link
Contributor

@LordHansolo, thank you for your report.
We've created internal ticket(s) MAGETWO-82054 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 17, 2017
@henk-hypershop
Copy link

What will be the expected fix timeframe? It is quite confusing that all depend labels are still shown.

@VincentMarmiesse
Copy link
Contributor

Hello,
Any news on this issue?

@maartenwolfsen
Copy link

maartenwolfsen commented May 16, 2019

In my case, the problem was that the selected rowElement was the child of the rowElement that was supposed to be hidden. I added the following piece of code to fix this to
lib/web/mage/adminhtml/form.js line 567:

if (rowElement.className === 'admin__field-control control') {
rowElement = target.up(2);
}

I am currently looking for a better solution.

@sergey-solo sergey-solo self-assigned this Aug 1, 2019
@m2-assistant
Copy link

m2-assistant bot commented Aug 1, 2019

Hi @sergey-solo. 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:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@OvalMedia
Copy link

For the impatient here is a fix: https://magento.stackexchange.com/questions/176091/magento-2-depends-is-not-working-in-widget-xml. Make sure you consider the first comment as the require-config.js is placed in the wrong directory. I can confirm it works fine on 2.2.9.

@ghost ghost unassigned sergey-solo Sep 27, 2019
@koenner01
Copy link
Contributor

koenner01 commented Oct 29, 2019

I can confirm this issue is still present in 2.3.3.

Fix from @OvalMedia works but I really don't like copying a gigantic javascript and appending 3 lines. This is not very future (= maintainable) proof.

@hostep
Copy link
Contributor

hostep commented Oct 20, 2020

Here's a solution which seems to work in our case, it's strongly based on the stackexchange proposal but drops the original PrototypeJS implementation and uses jQuery all the way now: #30570

@ghost ghost removed this from Ready for Dev in Community Backlog Oct 20, 2020
@ghost ghost removed this from Ready for Development in Low Priority Backlog Oct 20, 2020
@ghost ghost removed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Oct 20, 2020
@sidolov sidolov added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. and removed Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Oct 21, 2020
@ghost ghost added this to Pull Request In Progress in High Priority Backlog Oct 21, 2020
@ghost ghost removed this from Confirmed in Issue Confirmation and Triage Board Oct 21, 2020
@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Oct 24, 2020
@magento-engcom-team
Copy link
Contributor

Hi @LordHansolo. Thank you for your report.
The issue has been fixed in #30570 by @hostep in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.2 release.

@ghost ghost moved this from Pull Request In Progress to Done in High Priority Backlog Oct 24, 2020
@ghost ghost moved this from Done to Pull Request In Progress in High Priority Backlog Oct 24, 2020
@sidolov sidolov moved this from Pull Request In Progress to Done in High Priority Backlog Oct 27, 2020
@DmitryFurs
Copy link
Contributor

DmitryFurs commented Oct 28, 2020

@magento-engcom-team @sidolov @ihor-sviziev the corresponding pull request is merged, but the fix does not cover all possible cases. 2 additional cases are described in the comments to the pull request #30570

magento-engcom-team pushed a commit that referenced this issue May 27, 2021
MC-32830: Do not store admin and customer tokens in DB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Cms Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Development

Successfully merging a pull request may close this issue.