web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Restrict text field on...
Power Apps
Answered

Restrict text field only to alphabets and spaces

(0) ShareShare
ReportReport
Posted on by 1,121

I have a text field "City Name" on my Power Apps Canvas App. How can I restrict the text field only to Alphabet and Spaces. It shouldn't allow any special characters or numbers. 

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,330 Most Valuable Professional on at

    There is no easy way to limit the characters that a user enters into a text field.  However, you could easily setup a label with an error message and have that message display if the user types a non-allowed character by testing the input with an IsMatch() regex expression.

  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @RameshMukka 
    This is not possible in a Power Apps text field.  You can restrict input to numbers only but not letters.

    As a workaround you can check whether only letters and spaces were input into the text box using this code

     

    IsMatch(TextInput1.Text, "[a-zA-Z\s]+")

     

    More details on the ISMATCH function here:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-ismatch

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @RameshMukka ,

    Do you want to restrict a textinput that user could only enter Alphabet and Spaces?

    I'm afraid it's not supported to directly restrict a textinput to not allow characters or numbers. 

    For a textinput, you could only restrict whether you enter number or text. Text includes Alphabet, Spaces and character.

    727.PNG

     

    As an alternative solution, I suggest you add a justification when updating.

    If the data in textinput includes characters or numbers, you could not update data and get a warning.

    If the data in textinput only includes Alphabet and Spaces, you could update successfully.

    You just need to set the submit button's OnSelect like this:

    If(IsMatch(TextInput1.Text, "[a-zA-Z\s]+"),
    //[a-zA-Z\s] represents Alphabet and Spaces, + represnets one or more
     SubmitForm(formname),
     Notify("please do not enter character or number in this field!",NotificationType.Warning)
    )
     

     

    Best regards,

     

  • Sri Profile Picture
    559 on at

    Hi,

    In my case I have a number field which allows + and - symbol to enter in the field and gives a error message " The value - cannot be converted to a number". For other special characters it's not allowing to enter. 

     

    Any help would be greatly appreciated.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard