0

I have created custom field in Magento 2.4.1 product edit page,

product_form.xml

<field name="type" formElement="select">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">Ceymox\DigitalCard\Model\DigitalCard\Options</item>
                <item name="config" xsi:type="array">
                    <item name="source" xsi:type="string">block</item>
                </item>
            </argument>
            <settings>
                <dataType>select</dataType>
                <label translate="true">Digital Card Type</label>
                <dataScope>type</dataScope>
            </settings>
        </field>

        <file name="csv_uploader" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string">CSV File</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="formElement" xsi:type="string">fileUploader</item>
                    <item name="componentType" xsi:type="string">fileUploader</item> 
                    <item name="notice" xsi:type="string" translate="true">Allowed file type: csv.</item>
                    <item name="allowedExtensions" xsi:type="string">csv</item>
                    <item name="uploaderConfig" xsi:type="array">
                        <item name="url" xsi:type="url" path="digitalcard/index/generate"/>
                    </item> 
                </item>
            </argument>
        </file>
        
        <insertListing name="digitalcard_listing" >
            <settings>
                <dataLinks>
                    <exports>false</exports>
                    <imports>true</imports>
                </dataLinks>
                <autoRender>true</autoRender>
                <selectionsProvider>digitalcard_listing.digitalcard_listing.columns.ids</selectionsProvider>
                <dataScope>digitalcard_listing</dataScope>
                <ns>digitalcard_listing</ns>
            </settings>
        </insertListing>
     </fieldset>

Now I need to hide this field based on condition(based on product type).How can i do this? can anyone help me on this

0

Check this link for reference :-

How to Create Dependent Fields in Forms using Ui components- Magento2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.