2

I have tried to override the form validation for telephone which added in core file vendor\magento\module-customer\view\base\ui_component\customer_form.xml as follow:

 <field name="telephone">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">text</item>
                <item name="formElement" xsi:type="string">input</item>
                <item name="source" xsi:type="string">address</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
                </item>
            </item>
        </argument>
 </field>

Tried to override this file in local module and changed the line

<item name="required-entry" xsi:type="boolean">false</item>

This remove only the mandatory (*) mark from address form for telephone number but the validation remain same.

If you removed the complete entry from base file (vendor\magento\module-customer\view\base\ui_component\customer_form.xml) then complete validation get also removed. anyone know how we can override the form config validation using local module?

0

At the moment making telephone optional requires quite a lot of coding. There is a discussion at github about this resulting in a module (github:/zsoerenm/magento2-optionaltelephone) being developed thats sole purpose is exactly this. However, the magento devs have already implemented a solution in core to address this. The fix in the development branch now and hopefully will soon be in master.

| improve this answer | |

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.