1

This is more or less a duplicate of a support ticket raised with Solspace. I’ve no doubt they will provide an answer but if anyone else has one feel free to pitch in.


I'm using Freeform forms to register user accounts into a specific user group per form. It could arise that a would-be user is already registered, so I need to handle them trying to create a user account for an email address already in the system.

It appears that form.hasErrors prevents a duplicate account being created but doesn’t return any message that that’s what has happened within the form.errors loop.

I'm imagining I could do something like the following to assume that a prior user account is the issue, but it would be good if there was something more systematically robust:

{% if form.hasErrors %}
    {% if form.errors|length %}
        {# Report errors #}
    {% else %}
        {# Assume that an existing user account is the issue #}
    {% endif %}
{% endif %}

Is there a better way?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.