8 Replies Latest reply on Jan 3, 2014 5:16 PM by KenGreenberg

    Phone number input mask

    DawnPaquette

      Title

      Phone number input mask

      Post

      Im so new i squeak to file maker pro, that being said i have read from the knowlege base and the forums about input masks for the phone number. none have worked for me. so either as a new user i did something wrong on the set up or something changed from prior versions of the program possibly.

       

      I am using FM Pro 11. the phone number is a text field named Phone1 and a second field as Phone2 and im wanting the normal (xxx) xxx-xxxx input mask.

      I have removed the prior settings from the options on those fields that i had tried when following the posts i read on them so back to a blank slate to work with.

      my file has 500+ customers all using that format alrdy but entered manually.

       

      Thanks in advance for your help

        • 1. Re: Phone number input mask
          philmodjunk

          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?

          • 2. Re: Phone number input mask
            DawnPaquette

            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.
            • 3. Re: Phone number input mask
              philmodjunk

              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.

              • 4. Re: Phone number input mask
                m10muhammad

                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?

                • 5. Re: Phone number input mask
                  DawnPaquette

                  Yay that worked!! thanks again bunches!

                  • 6. Re: Phone number input mask
                    philmodjunk

                    @m10muhammad,

                    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 */ ;

                    • 7. Re: Phone number input mask
                      m10muhammad

                      Thanks!

                      • 8. Re: Phone number input mask
                        KenGreenberg

                             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!