Question

In Magento 2.3.1, I want to do like :

If all store view, then input text should be enable. Othervise, input text should be disable.

I follow this answer : click here

But, still I'm not getting output.

How to do that?

Any help would be appreciated.

Thanks.

Was it helpful?

Solution

your form element should be like:

   <field name="sort_order" formElement="input">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="source" xsi:type="string">page</item>
            </item>
        </argument>
        <settings>
            <validation>
                <rule name="required-entry" xsi:type="boolean">true</rule>
            </validation>
            <dataType>text</dataType>
            <label translate="true">Sort Order</label>
            <dataScope>sort_order</dataScope>
             <imports>
                <link name="disabled">${ $.provider}:data.do_we_hide_it</link>
            </imports>
        </settings>
    </field>


   **And you Dataprovider condition should be like below:**



        if ($storeId && $storeId != 0) { 
        $this->loadedData[$banner->getBannerId()]['do_we_hide_it'] = true; 
        } else { 
        $this->loadedData[$banner->getBannerId()]['do_we_hide_it'] = false; 
        } 
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top