Closed
Description
Preconditions
- Magento 2.4-develop
- PHP 7, MySQL: ANY
Steps to reproduce
- Create a custom widget with widget.xml file
- Create a select option chooser
<parameter name="test_select" xsi:type="select" visible="true" required="true" sort_order="10">
<label translate="true">Select</label>
<options>
<option name="val_1" value="val_1" selected="true">
<label translate="true">Value 1</label>
</option>
<option name="val_2" value="val_2">
<label translate="true">Value 2</label>
</option>
</options>
</parameter>
- Create a CMS block Chooser that needs the second option selected
<parameter name="block_2_id" xsi:type="block" visible="true" required="true" sort_order="30">
<label translate="true">Block 2</label>
<depends>
<parameter name="test_select" value="val_2" />
</depends>
<block class="Magento\Cms\Block\Adminhtml\Block\Widget\Chooser">
<data>
<item name="button" xsi:type="array">
<item name="open" xsi:type="string" translate="true">Select Block...</item>
</item>
</data>
</block>
</parameter>
Expected result
- When I select the Val 1, CMS Chooser is not visible
- When I select the Val 2, CMS Chooser is visible
Actual result
- When I select the Val 1, CMS Chooser is visible
- When I select the Val 2, CMS Chooser is visible
I checked: /lib/web/mage/adminhtml/form.js
In trackChange function, I add log after getting target row: console.log(idTo);
(line 450 ~)
It tries to get item "options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id" but this selector doesn't exists! If I try $('options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id') I get NULL.
Generated HTML for CMS chooser is:
<div class="admin__field field field-options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id with-addon required _required with-note"
data-ui-id="widget-instance-edit-tab-properties-fieldset-element-form-field-options-fieldset61f7a8d3475b5def75f144b49f5d69a9-block-2-id">
<label class="label admin__field-label" for="options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id"
data-ui-id="widget-instance-edit-tab-properties-fieldset-element-label-parameters-block-2-id-label"><span>Block 2</span></label>
<div class="admin__field-control control">
<div class="admin__field">
<div class="control-value"></div>
<label class="widget-option-label"
id="options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_ided82f16acfe32d39acd5b9f1d94c5fc2label">Onepage
Success</label>
<div id="options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_ided82f16acfe32d39acd5b9f1d94c5fc2advice-container"
class="hidden"></div>
</div>
<div class="note admin__field-note" id="options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id-note"></div>
</div>
</div>
<div class="admin__field field field-chooseroptions_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id with-addon"
data-ui-id="widget-instance-edit-tab-properties-fieldset-element-form-field-chooseroptions-fieldset61f7a8d3475b5def75f144b49f5d69a9-block-2-id">
<label class="label admin__field-label" for="chooseroptions_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id"
data-ui-id="widget-instance-edit-tab-properties-fieldset-element-note-label"><span></span></label>
<div class="admin__field-control control">
<div class="admin__field">
<div id="chooseroptions_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_id"
class="control-value admin__field-value"></div>
<input id="options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_ided82f16acfe32d39acd5b9f1d94c5fc2value"
name="parameters[block_2_id]"
data-ui-id="widget-instance-edit-tab-properties-element-hidden-parameters-block-2-id" value="2"
class="widget-option required-entry" type="hidden">
<button id="options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_ided82f16acfe32d39acd5b9f1d94c5fc2control"
title="Select Block..." type="button" class="action-default scalable btn-chooser"
onclick="options_fieldset61f7a8d3475b5def75f144b49f5d69a9_block_2_ided82f16acfe32d39acd5b9f1d94c5fc2.choose()"
data-ui-id="widget-button-9">
<span>Select Block...</span>
</button>
</div>
</div>
</div>
Thanks for your help! It seems to be a bug with widget chooser (like CMS block) and depends!
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.4-develop branchGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentA defect with this priority could have functionality issues which are not to expectations.The issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.4-develop branchMajor restrictions or short-term circumventions are required until a fix is available.Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Type
Projects
Status
Done