2

I am using the registration form from the docs here - https://craftcms.com/docs/templating/user-registration-form - in the front end of my site. Unfortunately, when I click on "Register" the page just refreshes and no errors are displayed, and the user is not created.

I have checked the following:

  • "Allow Public Registration?" is checked in the CP.
  • I made sure that the Snaptcha plugin was disabled (just in case).

Any ideas on what I should look for?

Thanks!

<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="users/saveUser">
<input type="hidden" name="redirect" value="/success/">

{% macro errorList(errors) %}
    {% if errors %}
        <ul class="errors">
            {% for error in errors %}
                <li>{{ error }}</li>
            {% endfor %}
        </ul>
    {% endif %}
{% endmacro %}

{% from _self import errorList %}

<label for="username">Username</label>
<input id="username" type="text" name="username"
    {%- if account is defined %} value="{{ account.username }}"{% endif -%}>

{% if account is defined %}
    {{ errorList(account.getErrors('username')) }}
{% endif %}

<label for="email">Email</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 %}

<label for="password">Password</label>
<input id="password" type="password" name="password">

{% if account is defined %}
    {{ errorList(account.getErrors('password')) }}
{% endif %}

  <div class="divider"></div>


<input type="submit" value="Register" class="submit">
</form>
  • Can you check through your craft/storage/runtime/logs files for any [error] or [warning] logs that might be related? – Brad Bell Sep 2 '14 at 21:57
  • Thanks @BradBell! Yes - I checked that too, although I didn't see anything that looked like a login error. Just an error about status: FROM craft_tasks` WHERE (level = 0) AND (status = :status). Bound with :status='error') 2014/09/02 21:50:09 [profile] [system.db.CDbCommand.query] end:system.db.CDbCommand.query(SELECT count(id)` - Could that be related? – Angela Sep 2 '14 at 22:01
  • That shouldn't matter. Can you share your template code in the original question? – Brad Bell Sep 2 '14 at 22:11
  • Np! Added the code @BradBell – Angela Sep 2 '14 at 22:23
  • Hrm... maybe you've got some required fields on your User field layout that the front-end form isn't taking into account? – Brad Bell Sep 2 '14 at 22:41
3

Solved the mystery. :) The issue was that even though my user fields were not required, there was a numeric 'year' field which had min and max values set, and this was throwing it off (and I had removed that field during my last round of testing to keep things simple). Removing those required min and max values allowed the form to be submitted. Thanks for the help Brad!

  • Ahh... nice catch! – Brad Bell Sep 3 '14 at 3:16

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.