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

Checkbox UI Component valueMap returns wrong data type #27160

Closed ghost closed 1 month ago

ghost commented 4 years ago

Preconditions (*)

  1. Magento 2.3.3-p1

Steps to reproduce (*)

  1. Create checkbox UI Component in a form
  2. Use valueMap to set the following
false true

Expected result (*)

  1. Checkbox should return a boolean

Actual result (*)

  1. Data returned is a string Screen Shot 2020-03-04 at 13 36 00
m2-assistant[bot] commented 4 years ago

Hi @paul-gene. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@paul-gene do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


m2-assistant[bot] commented 4 years ago

Hi @engcom-Echo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Echo commented 4 years ago

Hi, @paul-gene. Thank you for your report.

Please provide some of the code you use in *.xml

<formElements>
                <checkbox>
                    <settings>
                        <prefer>toggle</prefer>
                        <valueMap>
                            ......
                        </valueMap>
                    </settings>
                </checkbox>
            </formElements>
ghost commented 4 years ago

@engcom-Echo literally the code from the devdocs

<field name="myCheckbox" formElement="checkbox">
            <settings>
                <label translate="true">Enabled</label>
                <tooltip>
                    <description translate="true">This is my checkbox's description</description>
                </tooltip>
            </settings>
            <formElements>
                <checkbox>
                    <settings>
                        <prefer>toggle</prefer>
                        <valueMap>
                            <map name="false" xsi:type="boolean">false</map>
                            <map name="true" xsi:type="boolean">true</map>
                        </valueMap>
                    </settings>
                </checkbox>
            </formElements>
        </field>
magento-engcom-team commented 4 years ago

@engcom-Echo Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again. Thanks!

magento-engcom-team commented 4 years ago

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

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

ghost commented 4 years ago

@engcom-Echo FYI, its not just the boolean data type that has issues, it happens with numbers as well. All outputted values are strings, regardless of the set data type.

m2-assistant[bot] commented 4 years ago

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


niravkrish commented 4 years ago

Hi @paul-gene,

I have created admin form and try to generate the issue with your code in Magento-2.3.4. but I can not able to reproduce this issue. Please see the attachment.

Also one thing I need to know from you is how you are checking the value of the ui component. as per your screenshot I saw something like watches. what is watches and how can I check. is it any tool.

Thank you, Nirav Patel Screenshot from 2020-03-17 18-16-36

ghost commented 4 years ago

@niravkrish you are checking the console though. This is an issue in the PHP code.

engcom-Bravo commented 1 month ago

As per this comment https://github.com/magento/magento2/issues/27160#issuecomment-600051514 we are closing this issue.

Thanks.