1

Hello I added an custom customer attribute "kndnumber" to my register page. Attribute is successfully created in DB. My Problem is when I submit the user register request the error Messsage "Kundennummer" is a required field. shows up even if the value is in the request body. I Implemented the frontend as following

  1. Created custom Module
  2. Added CustomModule/view/frontend/templates/additional.phtml
  3. Added CustomModule/view/frontend/layout/customer_account_create.xml

additional.phtml

<div class="field kndnumber required">
    <label class="label" for="kndnumber">
        <span><?= $block->escapeHtml(__('Kundennummer')) ?></span>
    </label>
    <div class="control">
        <input type="text" name="kndnumber" id="kndnumber" value="" title="<?= $block->escapeHtmlAttr(__('Kundennummer')) ?>" class="input-text" data-validate="{required:true}">
    </div>
</div>

customer_account_create.xml

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="form.additional.info">
            <block class="Magento\Framework\View\Element\Template" name="form_additional_info_customer" template="Magento_CustomerAttribute::additional.phtml"/>
        </referenceContainer>
    </body>
</page>

Registeruser

But I´m getting the error displayed in the picture. The Backend says the field is required which is true because I want it that way. But I have the kndnumber in my request why does the backend say it´s not I dont get it.

Does anyone have a clue what the problem is?

This is the attribute in the table 'customer_eav_attribute' test

Your Answer

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

Browse other questions tagged or ask your own question.