If anyone has a simple solution that will allow the user to enter a social security number and have it automatically add the "-" please let me know.
I don't believe this has ever been solved. @mdevaney posted a solution that works for US phone numbers, but this solution is very complicated for what it does and the killer of it is it won't allow for a number that starts with a 0, which some social securities do.
Therefore, I'm wondering does everyone else just have the users either:
A. Enter just the number
Or
B. Enter it as text and required them to type the hyphens.
I've searched and if there is a simple way to do this without sliders, timers, etc. I would LOVE to see it posted here. The fact that PowerApps doesn't support Input masking as a property is a big miss by MS. The fact that it hasn't been fixed is sad.
Thanks!
To summarize, I used some parts of all 3 solutions to come up with what I believe works with a screen that has fields on it that are populated based on what the user selects in the gallery. I will post the final version of what I did, once it is through testing as I don't want to post until I'm 100% sure there are no issues. Thanks again to all the contributions as this really has never been solved using just one text field (before now, IMO).
This depends on how your app works, could do it multiple ways. Would need to suit your in app processes / needs.
You did not mention that the field was in a Gallery - you will need to Patch each record as you write it to the data source of the Gallery and then have the Default
Coalesce(
ThisItem.YourSSNFieldName,
varSSN
)
@EddieE This appears to work, but I need to to be able to default it to what is stored in my record. How would I change this to accomplish that. the SSN is stored in gblSelectedProvider.ProviderSocialSecurityNBR.
Thanks!
I'm going to try out all the solutions offered and if they all work then I'll mark all of them as solutions. As we all know there is always more than one way to skin the PowerApps cat 🙂 lol
@WarrenBelz I finally got to try this. I used the varSSN as the Default to keep it simple to start. I type in my SSN and when I leave the field it clears it. I put a label above it and set it to the varSSN, which shows the SSN formatted, but I'm not sure what I did wrong so that it clears the Text Input field.
Before I move to the next field:
After I move to the next field:
Any ideas? Thanks
This video gives some further ideas
https://www.youtube.com/watch?v=povxwFZ4yik
Using it, I got this working - which isn't quite there
// Add a TextInput
// Format
Text
// Default
varTempTextInput
// OnChange
UpdateContext({varTempTextInput: Text(Value(Self.Text), "0##-##-####")})
This can solve the '0' issue you mention but needs some work to manage number of values entered.
Hope it can help?
Thanks @WarrenBelz and @leonsig93 , I'm just now waking up (different time zone :-)) to all these responses so I'm going to check it out this morning.
Hey @WarrenBelz , no I'm a different user. I was writing up my post while testing how to do it and didn't notice you had already replied cause I hadn't refresh the page in a while 😅.
Didn't think to add validation to make sure they only input numbers.
@leonsig93 (I assume you are also @subsguts ,
I did not bother with the MaxLength as it only triggers on 9 numeric characters (I see you have deleted the Numeric test), but yes, the Boolean Variable is another slightly different way of doing it. I am not into Modern Controls at this point, but if it works for you, that is good. I assume this is now solved ?
WarrenBelz
42
Most Valuable Professional
mmbr1606
41
Super User 2025 Season 1
MS.Ragavendar
36