How to add custom field in signup(CREATE ACCOUNT) page in frontend. I have tried some example module but i am getting this

Error "1 exception(s): Exception #0 (Magento\Framework\Exception\LocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. The following modules are outdated: Multi_Beta data: current version - none, required version - 0.1.1"


    namespace Multi\Beta\Setup;
     use Magento\Framework\Module\Setup\Migration;
    use Magento\Framework\Setup\InstallDataInterface;
    use Magento\Framework\Setup\ModuleContextInterface;
    use Magento\Framework\Setup\ModuleDataSetupInterface;
    class InstallData implements InstallDataInterface
         * Customer setup factory
         * @var \Magento\Customer\Setup\CustomerSetupFactory
        private $customerSetupFactory;
         * Init
         * @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
        public function __construct(\Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory)
            $this->customerSetupFactory = $customerSetupFactory;
         * Installs DB schema for a module
         * @param ModuleDataSetupInterface $setup
         * @param ModuleContextInterface $context
         * @return void
        public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

            $installer = $setup;
            $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
            $entityTypeId = $customerSetup->getEntityTypeId(\Magento\Customer\Model\Customer::ENTITY);
            $customerSetup->removeAttribute(\Magento\Customer\Model\Customer::ENTITY, "my_attribute");

            $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "my_attribute",  array(
                "type"     => "varchar",
                "backend"  => "",
                "label"    => "My Attribute",
                "input"    => "text",
                "source"   => "",
                "visible"  => true,
                "required" => true,
                "default" => "",
                "frontend" => "",
                "unique"     => false,
                "note"       => ""

            $my_attribute   = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "my_attribute");

            $my_attribute = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, ' my_attribute');
            $my_attribute->setData("used_in_forms", $used_in_forms)
                ->setData("is_used_for_customer_segment", true)
                ->setData("is_system", 0)
                ->setData("is_user_defined", 1)
                ->setData("is_visible", 1)
                ->setData("sort_order", 100);


<?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">
            <referenceContainer name="form.additional.info">
                <block class="Magento\Framework\View\Element\Template" name="my_form_additional_info_customer" template="Multi_Beta::additionalinfocustomer.phtml"/>


<fieldset class="fieldset create account" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>">
        <legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Additional Information') ?></span></legend><br></p>

<p>        <div class="field my_attribute required">
            <label for="my_attribute" class="label"><span><?php /* @escapeNotVerified */ echo __('My Attribute') ?></span></label>
            <div class="control">
                <input type="text" name="my_attribute" id="my_attribute" title="<?php /* @escapeNotVerified */ echo __('My Attribute') ?>" class="input-text" data-validate="{required:true}" autocomplete="off">


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Multi_Beta" setup_version="0.1.1">
            <module name="Magento_Directory" />
            <module name="Magento_Config" />

When i run magento setup:upgrade in CMD enter image description here

enter image description here

  • Check that setup_version in setup_module Commented Dec 4, 2017 at 12:46
  • Does this " php bin/magento setup:upgrade" run successfully after instaling this extension? Commented Dec 4, 2017 at 13:09
  • no.i have updated the question pls check again @DhirenVasoya
    – l12v6
    Commented Dec 4, 2017 at 13:11

1 Answer 1


You need to do this steps.

  1. Remove extension entry (Multi_Beta) from "setup-module" table.

  2. Remove extension attribute entry(my_attribute) from "eav_attribute" table.

  3. Run following command from CLI :

    php bin/magento cache:clean

    php bin/magento cache:flush

    php bin/magento indexer:reindex

    php bin/magento setup:upgrade

    php bin/magento setup:static-content:deploy

  • it didn't work, still facing same problem. I want to create a checkbox in frontend signup and save the value in table any other way to add checkbox without editing core files?
    – l12v6
    Commented Dec 4, 2017 at 14:05
  • 1
    "Attribute with same code already exist" error occures when attribute already in your database, So confirm that you have already remove your attribute entry from database and then run above command. Commented Dec 5, 2017 at 4:55
  • Now error is gone, but i don't think that my phtml file is running. Am i missing something? @Dhiren Vasoya
    – l12v6
    Commented Dec 5, 2017 at 7:22
  • For above question, your error solve now, right? Commented Dec 5, 2017 at 9:10
  • Yes, Thank you. Can you please suggest any reference to create a new field in create user registration form?
    – l12v6
    Commented Dec 5, 2017 at 10:38

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.