Tip: Interface patterns give you an opportunity to explore different interface designs. Be sure to check out How to Adapt a Pattern for Your Application.
GoalCopy link to clipboard
Format the user's input as a telephone number in the US and save the formatted value, not the user's input.
This expression uses the text()
function to format the telephone number. You may choose to format using your own rule, so you would create the supporting rule first, and then create an interface with the main expression.
This scenario demonstrates:
- How to configure a field to format a user's input
ExpressionCopy link to clipboard
1
2
3
4
5
6
7
8
9
10
11
12
a!localVariables(
local!telephone,
a!textField(
label: "Employee Telephone Number",
instructions: "Value saved: " & local!telephone,
value: local!telephone,
saveInto: a!save(
local!telephone,
text(save!value, "###-###-####;###-###-####")
)
)
)
Copy
Test it outCopy link to clipboard
- Enter
1234567890
then click somewhere else on the form. Notice that the phone number is now formatted.
FeedbackCopy link to clipboard
Was this page helpful?