Restrict search box input text to recognise existing strings in different case - not allow different case input and save for the same word

Hey @StevenM,

The traditional coders way to evaluate strings in a case insensitive manner is to convert everything to lower case values. You can use that here to compare the typed text, against the value of the search box.

Start with an expression element from the Toolbox plugin to make the value lowercase. I’m doing this in an expression because in a later step when I compare the two values, Bubble won’t let me use the :lowercase modifier on both sides of the equation.

Then in your workflow or actions use the following to trigger for existing values (regardless of case.) Example here to show an alert, and I’m only triggering if the user is entering a new value:

Or the opposite to trigger for new values:

Unfortunately, we can’t do a lowercase comparison in a search constraint in Bubble, so this means we’ll be pulling the entire dataset over and comparing in a filter. You’ll just have to see if this works well for you dataset.

EDIT: If the use of a filter isn’t performant, then you could always store a second version of your value, always as lowercase. That way you can easily do a lowercase comparison using a search constraint.



Looking to accelerate your app development?

Let me turn
:thinking: :tired_face: :confounded:

into
:grinning: :sunglasses: :woman_student:

Development through Coaching at https://uniqueideas.com or schedule a free intro session :gift:

Ken Truesdale
LinkedIn

5 Likes