Skip to main content
Microsoft logo
Power Apps
    • AI Builder
    • Automate processes
    • Azure + Power Apps
    • Build apps
    • Connect data
    • Pages
    • Take a guided tour
  • Pricing
    • Overview
    • Become a Partner
    • Find a Partner
    • Find partner offers
    • Partner GTM Resources
    • Blog
    • Customer stories
    • Developer Plan
    • Documentation
    • For IT Leaders
    • Roadmap
    • Self-paced learning
    • Webinars
    • App development topics
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • User groups
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Power Apps Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power Apps
    • Building Power Apps
    • Microsoft Dataverse
    • AI Builder
    • Power Apps Governance and Administering
    • Power Apps Pro Dev & ISV
    • Power Apps Portals
    • Connector Development
    • Power Query
    • GCC, GCCH, DoD - Federal App Makers (FAM)
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Community Blog
    • Power Apps Community Blog
    • Galleries
    • Community Connections & How-To Videos
    • Community App Samples
    • Webinars and Video Gallery
    • Canvas Apps Components Samples
    • Kid Zone
    • Emergency Response Gallery
    • Events
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Community Engagement
    • Community Calls Conversations
    • Experimental
    • Error Handling
    • Power Apps Experimental Features
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Power Apps Community
    • Galleries
    • Canvas Apps Components Samples
    • Phone Number Input Mask

    Phone Number Input Mask

    03-28-2022 19:39 PM

    mdevaney
    Community Champion
    5416 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    mdevaney
    mdevaney Community Champion
    Community Champion
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Phone Number Input Mask

    ‎03-28-2022 07:39 PM

    mdevaney_1-1648520436594.gif
    Description

    This Power Apps component is a simple text input that applies formatting to a phone number after each keystroke.  The text input only allows numbers to be entered.

    Here's how it works:

    • The app developer defines the phone number format as "(###) ###-####"
    • A user opens the app and types a phone number as 2049876543
    • The text input shows (204) 987-6543

     

    Give a Thumbs Up if you like the component to make it easier for others to find

    Follow me on Twitter for Power Apps tips & articles https://twitter.com/mattbdevaney 

    Send me a message if you find any bugs and I will fix them as quickly as possible


    Phone Number Input Mask Properties

    The Phone Number input mask shares the same properties as a Text Input along with 4 new properties.

    InputMask (input property) - A text string that defines the phone number formatting to be applied

    InputMaskMultipleFormats (input property) - A table that defines multiple phone number for countries with more than one phone number format.  To use this property the InputMask field must be blank.

    PhoneNumber (output property) - A unformatted text string with all digits in the phone number

     

    Text (output property) - A text string with the formatting phone number.


    Example - Single Phone Number Format

    To format a phone number for a country in the table below use the following values InputMask property.

     

    Country Example InputMask
    Canada 204-998-8344 "###-###-####"
    US (204) 998-8344 "(###) ###-####"
    United Kingdom     +44 1234 567890     "+## #### ######"    
    Japan (03)-4567-1234 "(##)-####-####"
    India +91 0123 456789 "+## ####-######"



    Example - Multiple Phone Number Formats

     

    Here's how UK phone number formatting works:

    Numbers beginning 01 are 01### ######
    Numbers beginning 02 are 02# #### ####
    Numbers beginning 03 are 03## ### ####
    Numbers beginning 07 are 07### ######
    Numbers beginning 08 are 08## ### ####

    All other phone numbers are ##### ######

     

    Use this code in the InputMaskMultipleFormats property to define phone number formatting.  The InputMask property must be blank in order for multiple formats to appear.

    Table(
        {
            Prefix: "01",
            Format: "##### ######"
        },
        {
            Prefix: "02",
            Format: "### #### ####"
        },
        {
            Prefix: "03",
            Format: "#### ### ####"
        },
        {
            Prefix: "07",
            Format: "##### ######"
        },
        {
            Prefix: "08",
            Format: "#### ### ####"
        },
        {
            Prefix: "",
            Format: "##### ######"
        }
    )

     

    Limitations

     

    Power Apps components cannot be used in Galleries and Edit Forms.  To use this component you must create your own form and submit data using the PATCH function.  If you want to have this functionality inside of an Edit Form check out this article I wrote which shows how to build this components functionality from scratch.

    Link: https://www.matthewdevaney.com/power-apps-phone-number-formatting-in-a-form-input-mask/

    Phone Number Input Mask.msapp
    Labels:
    • Labels:
    • Components
    Message 1 of 2
    5,416 Views
    4 Kudos
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    DanW22
    DanW22
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-21-2022 08:18 PM

    @mdevaney I am having some trouble importing this component into a Power App, or a component library. Other community created components i have downloaded were imported successfully, but i get the following error message when trying to import your component; "to import from component libraries, save your library files to the cloud and select "Get more components" from the insert pane."

    Is it possible that your attached component file was for the component library it was created in and not just the component itself?

    I am relatively new to Power Apps, so a solution to this error would be greatly appreciated.

    Message 2 of 2
    4,714 Views
    0 Kudos
    Reply

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    Browse

    • Sample apps
    • Services

    Downloads

    • Windows
    • iOS
    • Android

    Learn

    • Documentation
    • Support
    • Community
    • Give feedback
    • Blog
    • Partners

    • © 2023 Microsoft
    • Follow Power Apps
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices