How to disallow numbers, spaces & special characters from input name in real time (while typing in input)

Hello Bubble Experts :wave:

How to disallow Numbers, Spaces & Special characters from an input name in real time (while typing in input).
I am quite stuck here?
Is it possible?

Thanks in advance for your help?

Edit:-
Solution is the combination of 2 posts here (Post 1 & Post 10)

Hi @mdburhan3 :wave:
yes it possible to detect in real time using plugin “Instant Text”

for example:-

But i am not sure about Regular expressions… but some other experts can help…

1 Like

Hi there, @mdburhan3… it may be possible (and from the looks of @viquarahmed07’s response, I guess it is), but I would question whether or not you should do it from a user experience perspective. Why not have some placeholder or help text that tells a user those characters are not allowed, and then if they do include one of those characters, validate it upon submission or even after the input’s value is changed. To validate the characters in real time and do something about it in real time seems like it could be jarring for the end user, but maybe I just don’t understand what you are trying to do here.

Anyway, just food for thought.

Best…
Mike

1 Like

Hi @mikeloc Thanks for your response :+1:
What my client wants to achieve is something like input content type email validator
When user types email it will show red color borders immediately…

Screenshot 2022-10-06 at 19.52.19
Screenshot 2022-10-06 at 19.52.10

1 Like

Hi @viquarahmed07
Thanks for the response i will try & let you know :+1:

Ah, okay. It makes sense in the context of an email input because it’s clear why the borders are red when the input does not contain something that looks like an email address. In the case of some sort of name field, I think the user will be wondering why in the heck the borders are red. So, if it was me, I would validate when the input’s value is changed and show a message that makes it clear what the user did wrong. But that’s just my two cents, and again, just food for thought because at the end of the day, what the client wants is what the client wants. :slight_smile:

1 Like

@viquarahmed07
It is working as expected
But i am unable to restrict spaces & special characters
I think i need to make some changes in my regex…

Can you help me how to do that (I don’t know much about Regex)?

@mikeloc Yes i agree (we are displaying the rule in placeholder)
I am not sure we might end up adding alert…
I just have to agree with what my client wants :man_facepalming:

1 Like

@mikeloc

:point_up_2: This excludes only numbers…
Do you know how to write Regex to exclude “Special characters” & “spaces”…

Hi @mdburhan3
Yes i just find out the answer from stack overflow

[0-9 -!@$%^&*()_+|~=`\\#{}\[\]:";'<>?,.\/]

In the Regex pattern , replace with this :point_up_2:

There can be other solutions too…

1 Like

@viquarahmed07 Thanks it works :tada: