Search code examples
twitter-bootstrapmeteormeteor-blazemeteor-accounts

How to add additional input fields to the form generated by useraccounts:bootstrap in MeteorJS?


I am using useraccounts:bootstrap package to develop a custom user registration form.

<template name="login">
    {{> atForm}}
</template>

The above template generates a login form with Email, Password fields and a registration form with Email, Password, Password (Again) fields.

How to add fields ( like First Name, Last Name, Address ) other than Email, Password, Password (Again) to the generated registration form?


Solution

  • Create a configuration file like accountConfig.js, add the required fields there and import this file to main.js of client.

    For example your accountConfig.js will be like this:

    AccountsTemplates.addFields([
    {
        _id: 'firstName',
        type: 'text',
        displayName: 'First Name',
        placeholder: 'Your First Name',
    },
    {
        _id: 'lastName',
        type: 'text',
        displayName: 'Last Name',
        placeholder: 'Your Last Name',
    },
    {
        _id: 'address',
        type: 'text',
        displayName: "Address",
        placeholder: "Your postal address",
        required: true,
    },
    

    ]);