Hi all,
I've been searching everywhere, but I can't find anyone who is looking for the same thing as me. I know I can create an input mask, but then I want to do one of two things with it. Either:
Any advice would be much appreciated!
To the best of my knowledge none of the controls in Power Apps actually support an input mask. You can use Regex to validate the input and show an error message if it doesn't match, but there isn't a formal property for applying an input mask.
Like @Pstork1 said there's no automatic change to a number that will display as they type.
If you have a number that is always in 8188887654 / 10 digit format with no separators you can display it properly using
"("&Left(TextInput1.Text,3)&")"&Mid(TextInput1.Text,4,3)&"-"&Right(TextInput1.Text,4)
this works great until someone types theirs in formated properly at which point pulling it from data would look crazy like this ((81)8)8-9152
so what you do when submitting these to the database is remove any formatting like so
Substitute(Substitute(Substitute(TextInput1.Text,"(",""),")",""),"-","")
now you can store the number as a basic 10 digit number in your database, not worry about people typing either or, and still display the version you want. Best of all worlds
When submitting that reformatted number i would also run a Len on it to ensure the user input the correct number of digits when typing their number, for safety. Like so
If(Len(Substitute(Substitute(Substitute(TextInput1.Text,"(",""),")",""),"-",""))=10,Substitute(Substitute(Substitute(TextInput1.Text,"(",""),")",""),"-",""),"Error")
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
180 | |
139 | |
96 | |
83 |