5 Replies Latest reply on Sep 3, 2009 2:37 PM by Keystone

    Phone field formatting

    ACOPcharity

      Title

      Phone field formatting

      Post

      hi everyone,

       

      might be a silly question. Is there a way to format a field to show phone number is a (xxx)xxx-xxxx format automatically as you input the numbers???

       

      thank you!

        • 2. Re: Phone field formatting
          davidanders
            

          The Above requires FMP 10 Advanced, apparently.

           


          PhoneNumber: Text
          In Options, click on Calculated Value and enter the following calculation.


          Let(Phone = Filter(Phone;"0123456789");"(" & Left(Phone;3) &
          ") " & Middle(Phone;4;3) & "-" &; Middle(Phone;7;4))

           

          This assumes the correct number of US phone numbers is added (10 digits) 



          • 3. Re: Phone field formatting
            mrvodka
               Yes but this only work upon field exit. If the user wants to "format automatically as you input the numbers" then a script trigger will be needed. Either a plugin or verion 10.
            • 4. Re: Phone field formatting
              ACOPcharity
                

              thanks davidanders! I just did as you said and it worked perfectly.... the only thing is that i had to remove the last semi colon from the formula just after the last & and it worked perfectly :) (and I just did that because fm wouldn't let me press ok with it there since it would give an instruction that something more was expected theer is the semicolon was there)...

               

              thank you!

              • 5. Re: Phone field formatting
                Keystone
                  

                This: (Let(phone = Filter(Home Phone;"0123456789");"(" & Left(phone;3) & ") " & Middle(phone;4;3) & "-" & Middle(phone;7;4)) works like a charm, thanks!

                 

                I'm wondering how to ALSO make the text formatting conform to the value of the field.. i.e. if I cut and paste a phone number out of a document that is in Times New Roman 14, and I want it to default it to Arial 11 when I paste the number into the field, how do I do that?

                 

                I know you can use the script 'TextFormatRemove (  Self )', in the "Specify Calculation" dialog box, but how do I add this script to (Let(phone = Filter(Home Phone;"0123456789");"(" & Left(phone;3) & ") " & Middle(phone;4;3) & "-" & Middle(phone;7;4)) so they both work together????

                 

                I'm new to writing scripts, bear with me!