Is there a way to validate individual custom values in a multiselect?

I am using a multiselect to allow user to enter multiple email addresses. The multiselect may be initialized with zero or more emails. The multiselect allows custom values. When a new email is entered, I would like that specific email address to be validated (probably regex for now), and if found invalid just the email/item would be highlighted red. Is there a way to natively do this?

Thank you,

Larry

@lkiss No, Multiselect doesn’t support native per-item validation or red highlight.

But you can still achieve the behavior like this:

  • Allow custom values

  • Run your own regex on multiselect.value

  • Show invalid emails separately (e.g., ListView/Text styled red)

  • Block submit if any invalid item exists

This is currently the only reliable approach.

3 Likes

Thank you @Vishal1620 . I ended up just having a single error message for all the invalid emails. Sometimes good enough is the best path.

This does leave me wondering if the community should be working on an open source repository of custom components. Something for another day I guess!!

2 Likes

I have a hunch that day may be coming sooner rather than later. This is a great example of a component upgrade that could be community sourced.

2 Likes

I definitely agree with @pyrrho!

We have some example sub-repo's in our Retool public Github repo that could potentially work for such an open source community repo.

I will be talking to our eng team about their thoughts on this. I am very curious about who would get pinged if one of you were to make a PR to that repo with such an custom component :sweat_smile: