0

I have a customer attribute that is "File Input", type is file and require is true but I do not let it show in customer register. When I try to create an account it displays the error like this: enter image description here

How can I ignore this error without changing the require of the attribute?

0
  • If the attribute is required but not provided at customer creation it fail backend validation. Consider a default value.
  • To remove frontend validation you have to make sure the attribute is not used in said forms.
  • Each Customer Attribute has a value that controls in which forms is used.
  • That value is called used_in_forms and it can be altered in an install script with the help of the Magento\Customer\Setup\CustomerSetup entity.

E.g. This piece of script makes the Customer Attribute is_authorised be used only in adminhtml_customer form.

             /**
             * is_authorised
             */
            $authorisedAttribute = $this->customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'is_authorised')
                ->addData(
                    [
                        'attribute_set_id'   => $attributeSetId,
                        'attribute_group_id' => $attributeGroupId,
                        'used_in_forms'      => ['adminhtml_customer'],
                    ]
                );
            $authorisedAttribute->save();
  • yes.when i called used_in_forms of "file input".i have : array(9) { [0]=> string(18) "adminhtml_customer" [1]=> string(23) "customer_account_create" [2]=> string(21) "customer_account_edit" [3]=> string(30) "customer_account_edit_frontend" [4]=> string(21) "is_customer_attribute" [5]=> string(12) "order_detail" [6]=> string(13) "show_in_email" [7]=> string(25) "show_in_email_new_account" [8]=> string(19) "show_order_frontend" } – Thành Trung Tô Dec 10 '18 at 13:21
  • The attributes I have for displaying at create account have " string(32) "customer_account_create_frontend" – Thành Trung Tô Dec 10 '18 at 13:23

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.