One does not simply format SSN fields in InfoPath 2010 - InfoPath Dev
in

InfoPath Dev

One does not simply format SSN fields in InfoPath 2010

Last post 03-25-2016 06:05 AM by NickiPT. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-15-2012 07:52 AM

    • Dudley
    • Not Ranked
      Male
    • Joined on 08-15-2012
    • Baton Rouge, LA
    • Posts 2

    One does not simply format SSN fields in InfoPath 2010

    Hello.

    I'm having a difficult time of getting my problem solved:

    I want my SharePoint 2010 users to enter 9 numbers on a SSN field list column, without having to bother with inputting dashes.

    I would then like the column to display the numbers in the column with hypens added.

    I've been trying to do this by using Infopath, or SPD, but have not found a successful solution.

    Can anyone offer some assistance?

    Thank you.

    Dudley Seamans
  • 08-15-2012 03:13 PM In reply to

    Re: One does not simply format SSN fields in InfoPath 2010

    You could add a rule to the field in InfoPath - the condition would be if the field doesn't contain "-" you could add it - using substring functions to get the numbers separated in groups. I'm not sure if you can do this in a calculated column in SharePoint - because you need to make sure the user hasn't already entered "-", right?

    Hilary Stoupa

  • 08-16-2012 07:19 AM In reply to

    • Dudley
    • Not Ranked
      Male
    • Joined on 08-15-2012
    • Baton Rouge, LA
    • Posts 2

    Re: One does not simply format SSN fields in InfoPath 2010

    Thank you, Hilary. Your suggestion really set me in the right direction for where to look.

    It turns out you can achieve the desired effect by selecting the target SSN field, in the control tools box, click default value, click the fx button and then enter this formula:

    concat(substring(translate(., "-", ""), 1, 3), "-", substring(translate(.,

    "-", ""), 4, 2), "-", substring(translate(., "-", ""), 6, 4))

    Dudley Seamans
  • 06-26-2015 06:12 AM In reply to

    • RyanY
    • Not Ranked
    • Joined on 06-26-2015
    • Posts 1

    Re: One does not simply format SSN fields in InfoPath 2010

    Thanks to both of you for asking, asnwering and posting the final solution to this question.  You guys saved me a ton of time this morning!
    Filed under:
  • 03-25-2016 06:05 AM In reply to

    Re: One does not simply format SSN fields in InfoPath 2010

    Actually, if you enter that code into the default value of the field, you'll end up with it showing "--" before the user even enters anything. A cleaner solution is to leave the default value blank and then put the following rules on the field:

    • Validation rule: If SSN is not blank and SSN does not match pattern Social Security number
    • Action rule: If SSN matches pattern Custom \d\d\d\d\d\d\d\d\d then Set SSN to concat(substring(translate(., "-", ""), 1, 3), "-", substring(translate(., "-", ""), 4, 2), "-", substring(translate(., "-", ""), 6, 4))


Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.