Answers.Body: <p>You don't mention what errors you're getting, but if you leave username blank, it will be set to whatever the email address is by default.</p>
  
  <p>Password for new user registration is a required field by default, though.</p>
  
  <p>If you wanted to alter this behavior, you'd have to write your own custom <a href="https://pluginfactory.io" rel="nofollow noreferrer">plugin</a> and have your form post to your plugin's controller action that enforced whatever custom user registration business logic your needs require.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T19:20:56.700Z
Answers.LastActivityDate: 2017-01-26T19:20:56.700Z
Answers.UserDisplayName: Brad Bell
Body: <p>I have a registration form that looks like this:</p>
  
  <pre><code>&lt;form method="post" accept-charset="UTF-8"&gt;
        {{ getCsrfInput() }}
        &lt;input type="hidden" name="action" value="users/saveUser"&gt;
        &lt;input type="hidden" name="redirect" value=""&gt;
  
        {% macro errorList(errors) %}
          {% if errors %}
            &lt;ul class="errors"&gt;
              {% for error in errors %}
                &lt;li&gt;{{ error }}&lt;/li&gt;
              {% endfor %}
            &lt;/ul&gt;
          {% endif %}
        {% endmacro %}
  
        {% from _self import errorList %}
  
        &lt;div class="top-row"&gt;
          &lt;div class="field-wrap"&gt;
            &lt;label for="firstName"&gt;First Name&lt;span class="req"&gt;*&lt;/span&gt;&lt;/label&gt;
            &lt;input type="text" id="firstName" name="fields[firstName]" required {%- if account is defined %} value="{{ account.firstName }}"{% endif %}"&gt;
            {{ account is defined and account ? errorList(account.getErrors('firstName')) }}
          &lt;/div&gt;
          &lt;div class="field-wrap"&gt;
            &lt;label for="lastName"&gt;Last Name&lt;span class="req"&gt;*&lt;/span&gt;&lt;/label&gt;
            &lt;input type="text" id="lastName" name="fields[lastName]" required {%- if account is defined %} value="{{ account.lastName }}"{% endif %}"&gt;
            {{ account is defined and account ? errorList(account.getErrors('lastName')) }}
          &lt;/div&gt;
        &lt;/div&gt;
  
        &lt;div class="top-row"&gt;
          &lt;div class="field-wrap"&gt;
            &lt;label for="email"&gt;Email&lt;span class="req"&gt;*&lt;/span&gt;&lt;/label&gt;
            &lt;input id="email" type="text" name="email" {%- if account is defined %} value="{{ account.email }}"{% endif %}&gt;
            {% if account is defined %} {{ errorList(account.getErrors('email')) }}{% endif %}
          &lt;/div&gt;
          &lt;div class="field-wrap"&gt;
            &lt;label for="company"&gt;Company&lt;span class="req"&gt;*&lt;/span&gt;&lt;/label&gt;
            &lt;input type="text" id="company" name="fields[company]" required {%- if account is defined %} value="{{ account.company }}"{% endif %}"&gt;
            {{ account is defined and account ? errorList(account.getErrors('company')) }}
          &lt;/div&gt;
        &lt;/div&gt;
  
  
  
        &lt;div class="top-row"&gt;
          &lt;div class="field-wrap"&gt;
            &lt;label for="country"&gt;Country&lt;span class="req"&gt;*&lt;/span&gt;&lt;/label&gt;
            &lt;input type="text" id="country" name="fields[country]" required {%- if account is defined %} value="{{ account.country }}"{% endif %}"&gt;
            {{ account is defined and account ? errorList(account.getErrors('country')) }}
          &lt;/div&gt;
          &lt;div class="field-wrap"&gt;
            &lt;label for="applicationArea"&gt;Application area&lt;/label&gt;
            &lt;input type="text" id="applicationArea" name="fields[applicationArea]" {%- if account is defined %} value="{{ account.applicationArea }}"{% endif %}"&gt;
            {{ account is defined and account ? errorList(account.getErrors('applicationArea')) }}
          &lt;/div&gt;
        &lt;/div&gt;
  
        &lt;h3&gt;&lt;label for="username"&gt;Username&lt;/label&gt;&lt;/h3&gt;
        &lt;input id="username" type="text" name="username"
                {%- if account is defined %} value="{{ account.username }}"{% endif -%}&gt;
  
        {% if account is defined %}
          {{ errorList(account.getErrors('username')) }}
        {% endif %}
  
        &lt;h3&gt;&lt;label for="password"&gt;Password&lt;/label&gt;&lt;/h3&gt;
        &lt;input id="password" type="password" name="password"&gt;
  
        {% if account is defined %} 
          {{ errorList(account.getErrors('password')) }}
        {% endif %}
  
        &lt;div class="form-footer"&gt;
          &lt;input class="button button-block" type="submit" value="Send request"&gt;
          &lt;p class="back-to-login"&gt;&lt;a href="#login" class="switcher"&gt;&lt;svg width="10" height="10" role="img"&gt;&lt;use class="closebtn__use" xlink:href="/assets/img/svg_sprite/svg_sprite.svg#arrow-pointer-right"&gt;&lt;/use&gt;&lt;/svg&gt;Go back to login&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>I made the custom fields firstName, lastName, company, applicationArea and assigned them as user profile fields. </p>
  
  <p>Problem is that I don't want the user to enter a password and username on registration but send them an activation mail later. If I register a user in the form above it is added to the user list and everything works fine.</p>
  
  <p>If i however remove to following part (since I don't want the username and password to the registration form):</p>
  
  <pre><code>&lt;h3&gt;&lt;label for="username"&gt;Username&lt;/label&gt;&lt;/h3&gt;
        &lt;input id="username" type="text" name="username"
                {%- if account is defined %} value="{{ account.username }}"{% endif -%}&gt;
  
        {% if account is defined %}
          {{ errorList(account.getErrors('username')) }}
        {% endif %}
  
        &lt;h3&gt;&lt;label for="password"&gt;Password&lt;/label&gt;&lt;/h3&gt;
        &lt;input id="password" type="password" name="password"&gt;
  
        {% if account is defined %}
          {{ errorList(account.getErrors('password')) }}
        {% endif %}
  </code></pre>
  
  <p>This last snippet comes from the standard Craft demo registration form.</p>
  
  <p>Any suggestions how to make te registration form work without the username and password?</p>
  
  <p>Thans in advance!</p>
  
  <p>Ps: I use Craft CMS 2.6.2958</p>
  
Tags: <form><registration>
Title: Registration form issue
ThreadText: # Registration form issue
  
  (Asked by: username_0 on 2017-01-26)
  
  I have a registration form that looks like this:
  
  ```
  <form method="post" accept-charset="UTF-8">
        {{ getCsrfInput() }}
        <input type="hidden" name="action" value="users/saveUser">
        <input type="hidden" name="redirect" value="">
  
        {% macro errorList(errors) %}
          {% if errors %}
            <ul class="errors">
              {% for error in errors %}
                <li>{{ error }}</li>
              {% endfor %}
            </ul>
          {% endif %}
        {% endmacro %}
  
        {% from _self import errorList %}
  
        <div class="top-row">
          <div class="field-wrap">
            <label for="firstName">First Name<span class="req">*</span></label>
            <input type="text" id="firstName" name="fields[firstName]" required {%- if account is defined %} value="{{ account.firstName }}"{% endif %}">
            {{ account is defined and account ? errorList(account.getErrors('firstName')) }}
          </div>
          <div class="field-wrap">
            <label for="lastName">Last Name<span class="req">*</span></label>
            <input type="text" id="lastName" name="fields[lastName]" required {%- if account is defined %} value="{{ account.lastName }}"{% endif %}">
            {{ account is defined and account ? errorList(account.getErrors('lastName')) }}
          </div>
        </div>
  
        <div class="top-row">
          <div class="field-wrap">
            <label for="email">Email<span class="req">*</span></label>
            <input id="email" type="text" name="email" {%- if account is defined %} value="{{ account.email }}"{% endif %}>
            {% if account is defined %} {{ errorList(account.getErrors('email')) }}{% endif %}
          </div>
          <div class="field-wrap">
            <label for="company">Company<span class="req">*</span></label>
            <input type="text" id="company" name="fields[company]" required {%- if account is defined %} value="{{ account.company }}"{% endif %}">
            {{ account is defined and account ? errorList(account.getErrors('company')) }}
          </div>
        </div>
  
        <div class="top-row">
          <div class="field-wrap">
            <label for="country">Country<span class="req">*</span></label>
            <input type="text" id="country" name="fields[country]" required {%- if account is defined %} value="{{ account.country }}"{% endif %}">
            {{ account is defined and account ? errorList(account.getErrors('country')) }}
          </div>
          <div class="field-wrap">
            <label for="applicationArea">Application area</label>
            <input type="text" id="applicationArea" name="fields[applicationArea]" {%- if account is defined %} value="{{ account.applicationArea }}"{% endif %}">
            {{ account is defined and account ? errorList(account.getErrors('applicationArea')) }}
          </div>
        </div>
  
        <h3><label for="username">Username</label></h3>
        <input id="username" type="text" name="username"
                {%- if account is defined %} value="{{ account.username }}"{% endif -%}>
  
        {% if account is defined %}
          {{ errorList(account.getErrors('username')) }}
        {% endif %}
  
        <h3><label for="password">Password</label></h3>
        <input id="password" type="password" name="password">
  
        {% if account is defined %} 
          {{ errorList(account.getErrors('password')) }}
        {% endif %}
  
        <div class="form-footer">
          <input class="button button-block" type="submit" value="Send request">
          <p class="back-to-login"><a href="#login" class="switcher"><svg width="10" height="10" role="img"><use class="closebtn__use" xlink:href="/assets/img/svg_sprite/svg_sprite.svg#arrow-pointer-right"></use></svg>Go back to login</a></p>
        </div>
      </form>
  
  ```
  
  I made the custom fields firstName, lastName, company, applicationArea and assigned them as user profile fields.
  
  Problem is that I don't want the user to enter a password and username on registration but send them an activation mail later. If I register a user in the form above it is added to the user list and everything works fine.
  
  If i however remove to following part (since I don't want the username and password to the registration form):
  
  ```
  <h3><label for="username">Username</label></h3>
        <input id="username" type="text" name="username"
                {%- if account is defined %} value="{{ account.username }}"{% endif -%}>
  
        {% if account is defined %}
          {{ errorList(account.getErrors('username')) }}
        {% endif %}
  
        <h3><label for="password">Password</label></h3>
        <input id="password" type="password" name="password">
  
        {% if account is defined %}
          {{ errorList(account.getErrors('password')) }}
        {% endif %}
  
  ```
  
  This last snippet comes from the standard Craft demo registration form.
  
  Any suggestions how to make te registration form work without the username and password?
  
  Thans in advance!
  
  Ps: I use Craft CMS 2.6.2958
  
  **Tags:** form, registration
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-01-26. Score: 1
  
  You don't mention what errors you're getting, but if you leave username blank, it will be set to whatever the email address is by default.
  
  Password for new user registration is a required field by default, though.
  
  If you wanted to alter this behavior, you'd have to write your own custom [plugin](https://pluginfactory.io) and have your form post to your plugin's controller action that enforced whatever custom user registration business logic your needs require.
  
  
  ---
  
  