Forum Academy Marketplace Showcase Pricing Features

How to limit text input to lowercase alphanumeric characters with no spaces?

I need my users to type in a unique code for job positions that they will advertise somewhere else on the web.
When registering job positions in my app, my users should type in a unique code, and I will check if this code is unique and, if it is, I’ll store it in my database against the related Job Position thing.
The problem is, Text inputs allow users to enter anything.
How can I limit Text inputs to only alphanumeric lowercase characters with no spaces?
Thanks!

Is there a reason your users need to type in the code themselves?

There is a “Generate Random String function” (Dynamic options dropdown > Calculate formula). where you can specify lowercase letters and numbers. I haven’t run into this thing generating duplicates, but you can still run a check against saved strings to make sure.

The input element doesn’t let you restrict values in the way you’re asking. You can add the :lowercase modifier and I think even a :find and replace modifier to get rid of spaces, but special characters will still go through.


Gaby | Coaching Bubble

Hi Gaby,
I just wanted to make it nicer for the users as they will advertise that code in job recruitment ads, so their candidates can type those codes in and auto-invite themselves to my user’s job positions.
I managed to create some rules to trim and lowercase the code, and to check for uniqueness before saving it, so I guess I can keep it like that.
Thanks. Just wanted to check if I could control text input in a nicer way.
Cheers.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.