Field Masking - Specific Use SSN

4 views
Skip to first unread message

Oscar

unread,
Aug 5, 2020, 3:23:36 PM8/5/20
to Orbeon Forms
All,

I just wanted to see if there is a possibility to mask a field to have a formatted value that would match the U.S. SSN this format would be ###-##-####. I am looking to add the - between the digits.

As a second question, I am looking to  replace the first 5 digits with * is this something that could be achieved?

I am utilizing Orbeon Forms 2019.2.2

Regards,

Oscar

Alessandro Vernet

unread,
Aug 6, 2020, 6:12:51 PM8/6/20
to orb...@googlegroups.com
Hi Oscar,

If you consider what users type as a string, you can validate it matches a
certain format with a regex, and the function `matches(., 'your regex')`.
For validation, would this work for you?

Replacing the first 5 digits by "*" is a bit more tricky. You could do this
in a calculation, but that would also replace them in the data, which I
imagine you don't want. So, I think that if you also need this, you would
need to create your own XBL component, which would have the ability to show
to users something different than what is stored in the data.

As a side-note, I know that the goal is to prevent someone looking over the
user's shoulder to see the SSN after it has been entered, but having a
textfield where "55-555-5555" is replaced by "**-***-555" on tab out can
also be confusing. What is the user comes back to the field, and changes
"**-***-555" into "**-***-556"? Should you then change the stored value to
"55-555-5556"? If you need this, I think that it would be better if the
field changes its value back from "**-***-555" to "55-555-5555" when the
fields gets the focus. But again, you would need to create an XBL component
for this.

I hope this helps,

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/
Reply all
Reply to author
Forward
0 new messages