cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dani1107
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
CarlosFigueira
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
CarlosFigueira
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

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

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (55,315)