Well filemaker doesn't have input masks at all. Instead an auto-enter calculation is used to reconfigure the typed in text after the user exits the field.
Specifically, what have you tried and how didn't it work for you?
Answer ID 5839 followed thru steps 1 and 2 it does restrict numbers to 10 limit but no formatting took place there. this was one of the best for step by step, it just didnt work it seems tho step 2 number 5 was a bit confusing with arranging the layout.5. Right click [Mac: hold control and click] on the Masking filed, then select Field/Control > Behavior and uncheck all checkboxes.my best guess there was that it meant the inspector behavior area to uncheck the boxes when in edit layout mode.
That KB article is showing its age a bit. The Inspector is a new feature of filemaker 11 and they haven't updated this article to allow for the differences. Using Inspector | Data Tab | behavior to clear at least the browse mode check box is the correct equivalent.
Following the steps given, you get two fields, one that will hold just numbers and another, a calculation field called Masking that will show the formatted version of the phone number.
Are you able to get the "Masking" field to show the formatting?
Another approach that seems simpler to me:
Define an auto-enter calculation like this on a text field where the user will type in a phone number:
Let ( digits = filter ( self ; "01234456789" ) ;
Case ( Length ( digits ) = 7 ; Left ( digits ; 3 ) & "-" & Right ( digits ; 4 ) /* no area code */;
Length ( digits ) = 10 ; "(" & Left ( Digits ; 3 ) & ") " & Middle ( digits ; 4 ; 3 ) & "-" & right ( digits ; 4 ) /* area code */ ;
self /* error, don't modify user input */
) /* end case */
) /* end let */
clear the "do not replace existing value..." option and when the user types in a phone number, numbers with the correct number of digits will be reformatted with any non-numeric entries ignored.
Wow I was just about to ask the same question when I saw this topic!
What if I sometimes enter a number such as 18005551234 and I want it to be formatted as +1 (800) 555-1234? Can the calculation be altered so that if there if there are 11 digits, then it places a + sign and the first digit before the area code, and formats the subsequent 10 numbers as usual?
Yay that worked!! thanks again bunches!
Note that the case function tests the number of digits in order to apply different formatting, You can simply add another term to the case function to allow for additional possibilities. You can also check a specific digit, such as the first digit if you want.
You might insert this as the third "clause" in the case function:
Length ( digits ) = 11 and left ( digits ; 1 ) = 1 ; "+" & Left ( digits ; 1 ) & " (" & Middle ( digits ; 2 ; 3 ) & ") " & Middle ( digits ; 5 ; 3 ) & "-" & right ( digits ; 4 ) /* 1 + area code */ ;
This case calc solution is WAAY better than the masking solution Filemaker posts. I tried that, big hassle, got it working - then the next day it would give me a modifiable field error. I switched to this - and it works better - and looks better. Bravo!