cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Latin characters limitation

Hi guys,
someone knows, if there is an option to accept just the latin characters data set in Power apps?
Let's say: " ' " is allowed, instead of "

 

I want to avoid use substitution formula and start to list all the special characters one by one.

 

thanks for help 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps
Power Apps

There's no way to prevent it directly as the user is entering data, but you can give the user a visual indication that they entered an invalid character, and possibly prevent them from moving forward in the app (such as disabling a "next" button).

The attached app shows one way to implement this. It uses the IsMatch function to color the border of the text input in red if it contains any "invalid" character:

If(
    IsMatch(
        TextInput1.Text,
        "[ a-zA-Z!\""\$%&\'\(\)\*\+\,\.\-\/0-9:;<=>\?@\[\\\]\^_`\{\|\}~\r\n]*",
        MatchOptions.Complete),
    RGBA(0, 18, 107, 1),
    Color.Red)

If you want to know exactly which character is invalid, you can use an expression like the one below. The idea is to Split the text that you want to verify, then Filter the characters for invalid ones - I used the Find function to look for the character in a label that contained all the "valid" characters - then Concat all of them together to display in a label:

"Invalid characters: " &
    Concat(
        Filter(
            Split(TextInput1.Text, ""),
            IsBlank(Find(Result, lblAsciiCharacters.Text))),
        Result)

View solution in original post

2 REPLIES 2
Power Apps
Power Apps

There's no way to prevent it directly as the user is entering data, but you can give the user a visual indication that they entered an invalid character, and possibly prevent them from moving forward in the app (such as disabling a "next" button).

The attached app shows one way to implement this. It uses the IsMatch function to color the border of the text input in red if it contains any "invalid" character:

If(
    IsMatch(
        TextInput1.Text,
        "[ a-zA-Z!\""\$%&\'\(\)\*\+\,\.\-\/0-9:;<=>\?@\[\\\]\^_`\{\|\}~\r\n]*",
        MatchOptions.Complete),
    RGBA(0, 18, 107, 1),
    Color.Red)

If you want to know exactly which character is invalid, you can use an expression like the one below. The idea is to Split the text that you want to verify, then Filter the characters for invalid ones - I used the Find function to look for the character in a label that contained all the "valid" characters - then Concat all of them together to display in a label:

"Invalid characters: " &
    Concat(
        Filter(
            Split(TextInput1.Text, ""),
            IsBlank(Find(Result, lblAsciiCharacters.Text))),
        Result)

View solution in original post

Thanks Carlos! I will try to do that
I appreciate your help

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (46,685)