2

We have a user signup form (see http://thinkdif.co/me/signup) that has some extra required fields. When a craft field us missed out, the error code below works, however when a custom User field is not completed, the page does not save, but no error is presented.

We require errors on custom user signup fields, and also on the 'Update your profile' page that is presented later in the workflow.

Thanks for any help or examples. End goal is to have good required fields throughout the user workflow.

Dan

Example error code:

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

Edit:

Here is a gist of the full page. https://gist.github.com/slipstreamstudio/d8dd801d722c3f275b74

  • Have you set the field as required in the Control Panel? – Bryan Redeagle Jul 17 '14 at 12:50
  • Yes - all set but errors are not returning for custom fields. – Dan G Jul 18 '14 at 20:30
1
  1. There was a bug in Craft such that when saving a user, if the username / email / password failed validation first, content validation would never get a chance to run.

    Have just fixed that locally and it will go out in the next release.

  2. The way you have your dropdowns defined (userCountry and occupation), they'll never fail validation because there will always be a value selected and submitted in $_POST.

  3. The first name and last name fields on a user account are somewhat “special” fields. There is currently no way to set them as required. We've got some plans to revamp how user names are handled on “The List”™ for a future update. In the meantime, if you want to make them required fields, you can create actual custom fields for them.

| improve this answer | |
  • Thanks Brad - that will solve it - do you know when I can integrate this fix - I have a client desperate for the custom fields to work as required. – Dan G Jul 21 '14 at 7:15
  • 1
    Is there any update Brad on being able to make first name and last name fields required? I was researching how to do that and found this answer. For now I'll just use custom fields as you suggest. – Dave Joyce Jun 17 '16 at 16:58
  • Will this be in Craft 3? – Andrea DeMers Apr 14 '17 at 15:00

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.