Selector type populated via database field - or added to by the user dynamically

Feature

Selector type populated via database field - or added to by the user dynamically

Description

I’d like to prompt my users with a selector that contains values populated via an arbitrary database field, and from which they are able to select zero or more of those values.

If the particular value they are searching for is not found from that list, the user will have the option to add that particular value (and select it). This new value could then be added to the existing set of possible values (or at least, I would be able to add it myself manually at a later point).

Much like how the Tag or Category selector operates - the user can start typing and they will get a sub-selection of values returned, against which they’ll able to select the values they want. But, with the addition of user-supplied values too.

Use Case

I would like users to share the prior companies at which they have worked.

The feature would use a database field on the backend with, say, 1,000 of the most common companies my users might have worked at, populated by myself (maybe via a script, or directly pasted into the CWP admin page).

Example: existing company in database
User starts typing ‘A’, and the selector returns:
Adobe
Amazon
Apple
…the user selects ‘Apple’, and it now appears in a ‘badge’ at the top of the selector. The user can search and select more companies if they would like.

Example: company not in database
User types ‘Cisco’, but the selector does not return a result (because ‘Cisco’ is not currently in the database).
User is able to create ‘Cisco’, which they do, and now it appears in a ‘badge’ at the top of the selector. Additionally, ‘Cisco’ has been added to the selector source database field.

The UI for this selector would operate much like the “Optional Tags” field displayed when creating a new Topic in Discourse i.e. search for an existing tag, but create a new tag if need be.

Budget

500

2 Likes

Hey James, thanks for reaching out.

@fzngagan will be able to help you with this. I’ll leave you in his hands.

3 Likes

Hi James,
Just having a look. I’ll be back with a few questions so we can agree on the specifications.

2 Likes

Thanks! Please lmk if you need further context on use case, or idea input on UX - happy to provide both of course.

1 Like

Ok so you want the field to work exactly like the Optional Tags in the composer right?

Also sending a PM regarding further details.

As this data is associated with the user. It should be saved to the user fields. Just wondering where you want to display that data. On the wizard side of the things, it will be used with Update Profile action.

Hey @fzngagan - thanks for checking in; yes, I agree that it should be saved with the user fields - is it possible to use a Custom User Field based on Text type?

Perhaps multiple selections via this new CWP Selector type could be separated with commas when written to the Custom User field?

Based on the above use case, if a user selected “Amazon”, “Microsoft”, and, “Cisco” via the wizard, then the Update Profile Action would write “Amazon, Microsoft, Cisco” to the user’s Custom User field in their profile.

Technically, I guess the wizard Update Profile Action could write the resultant selection to any Text type User Profile field (and not necessarily a Custom User field) - but of course the CWP admin would need to ensure that they use this with care and only select a User Profile field that supports Text type (unless you’re able to only present suitable fields to them when customizing the wizard).

Hope that makes sense - please let me know if you need more details / examples.

Cheers, James

2 Likes

I’m assuming you simply need a comma separated list of values in any user field(custom or otherwise) and that’s it. From a product standpoint, I was wondering how you’ll use this feature as you haven’t requested to display this data anywhere?

For the specific use case of prior companies users have worked at - we would (1) display the (CSV) company list in the custom user field on both the user profile and popup card, and (2) build a custom profile search page that will allow users to find others who might have worked at Company A or Company B.

For (1), I’m assuming we’ll get that for free - i.e. Discourse will just display the values for this custom field.

For (2), the plan here would be to create this new site page and have a simple search mechanism index across user profile fields, including the custom entries that the CWP has written into the customer user profile field.

Definitely open to your thoughts / ideas on this approach of course!

1 Like

Yes, if you map to the correct field in the wizard custom fields. The user fields created by the dashboard have structure like user_field_x(off the top of my head) which you’re aware of I believe.

1 Like

Ack; so hopefully that answers your question @fzngagan on resultant captured data usage, but lmk if you need more context of course.

1 Like

Thats all for now. The work is already on. I was just trying to understand the scope.

Hi @james
Update:
I’ve come across an issue. Create: doesn’t show up on the wizard if the typed tag doesn’t already exist. Working on that now.

Thanks for the update. Please let me know if you’d like help - I’d be happy to spin up a new developer Discourse instance on a VPS and test what you have in progress.

1 Like

Ok I have it working. Just one point. We will need to discuss internally on whether this should be a part of actual plugin or a separate plugin. I think I can give it to you for testing tomorrow hopefully.