Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
I have 2 roles that a new user can choose when they create their account. For the most part it works as expected, but if the user does not select the role, the form fails to validate with the error message:
"An illegal choice has been detected. Please contact the site administrator."
There is also a corresponding error message in watchdog.
Is it possible to have a nicer error message to guide the user to the correct form element to fix?
Thank you
ice70
Comments
Comment #1
anzi31 CreditAttribution: anzi31 commentedAdded two roles that a new user can choose from when they create their account.
Was able to create accounts without selecting any role.
Could not duplicate error.
Comment #2
amitgoyal CreditAttribution: amitgoyal commentedI also tried this but couldn't reproduce the problem. Please provide more information so that we can reproduce this issue.
Comment #3
ice70 CreditAttribution: ice70 commentedHi,
thank you for trying.
My settings are as follows:
[User choice] admin/config/people/autoassignrole/user
User role assignment: Enabled
Roles: 2 custom created roles
User role selection: Single role
Selection method: Radio Buttons/Checkboxes
Required: yes [this should prevent 'Was able to create accounts without selecting any role.'?]
sorting: ascending
I will have a go with a frech install of drupal and nothing else to see if there is something in my site setup that may be the cause of this.
thank you
Comment #4
anzi31 CreditAttribution: anzi31 commentedApplied your settings and did not get the error.
The only message I got was that Role was required which was expected since it was set up that way.
Comment #5
mike.davis CreditAttribution: mike.davis commented