3

How to disable this input field, It's a custom attribute.enter image description here

1 Answer 1

5

Create a file called Namespace/Module/view/base/ui_component/customer_form.xml and add the following code:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="customer">
        <field name="your_custom_attribute_code" formElement="input">
            <settings>
                <disabled>true</disabled>
            </settings>
        </field>
    </fieldset>
</form>

Replace your_custom_attribute_code with your read-only attribute code.

1
  • Yes working fine. I have used in customer company attribute so we need to update the layout file and fieldset accordingly. Commented 14 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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