XF 2.0 Force selection from drop down

AndyB

Well-known member
I have the following Options:

1508861443864.webp

Normally the admin will start typing in a username and from the drop down a name is selected. The problem I would like to solve is if the admin just types in for example an email address there's nothing stopping that from being saved. I would like to make it so only a selection from the drop down is allowed, is this possible?

When I edit the field I have this:

1508861621193.webp

Thank you.
 
The entire point of the "User name input" type was that a username should be entered, verified as belonging to an actual user, and then stored as a user ID behind the scenes.

To make that possible, the "Data type" should be "Unsigned integer".

That way, only a valid username can be entered. But you should note that the option value will be stored as a user ID only. Therefore when you get the option value you will be querying for the user based on the user's ID rather than its user name.
 
Back
Top Bottom