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 / How to stop entering c...
Power Apps
Unanswered

How to stop entering characters in textbox..?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Mates,

we have a requirement, that is users can enter only numbers but not characters in textInput box.

i tired to change type property with "Number" but issue is can not enter comma if textInput box type is Number.

Means user has to enter number along with comma ex...30,20,50 etc but comma can`t enter (not allowing).

 your help is highly appreciated.

I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @Anonymous , 

    because the Numbers in Dynamics are not necessarily using the browser settings, I would use office ui fabric (fluent ui) for a number control: https://developer.microsoft.com/en-us/fluentui#/controls/web/textfield . 

    There you can specify the needed format.

    Otherwise I would take another react number control (maybe if you need the spinning buttons: up/down).

    Best regards,

    Diana

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @DianaBirkelbach 

    Thanks for reply.

    i really don`t know how to use office/fabric UI in powerapps.

    Showcode shows code but i dont think we can add our custom code in powerapps, please let me know how can we add.

     

  • OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi @Anonymous,

     

    You can check out this video from @a33ik on how to use office-fabric-ui and React with pcf. There is also a Microsoft front end bootcamp (link) that you can use to learn by building a todo app with react and office-fabric-ui.

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @Anonymous ,

    I thought that you mean a PCF (code component), that you can use in a Model or Canvas App.

     

    I had a look, and I'm not sure anymore that you can use the office-ui-fabric (fluent ui) TextField, since I don't find the property for the i18n  or pattern. 

     

    Making a number control with plain HTML is like looking for trouble. I've found only this (for instance for a german number):

    <input name="myinput" value="0" step="0.01" lang="de-DE" type="number" onchange="alert(this.value)"/>

    The "lang='de-DE'" should do it, but unfortunately works for me only in Firefox, but not in Chrome. So is not safe to use.

     

    A react component that I've already used for a HTMLWebResource in Dynamics365 is "react-number-input": https://www.npmjs.com/package/react-numeric-input , but you would have to format and parse the number by yourself.

     

    But if you are not looking for a PCF component, I cannot help much. I don't know how it's done in a CanvasApp without a code component.

     

    Best regards,

    Diana

  • Danish N. Profile Picture
    186 on at

    You can use IsMatch function and add regular expression. Something like below.

    If(
     IsMatch(
     TextInput1.Text,
     "\d+[\,\.]*\d+",
     MatchOptions.Contains
     ),
     Set(SetText, "Valid"),
     Set(SetText, "Invalid")
    )

    I have added this on "OnChange" function of Textbox. 


    ----
    Danish Naglekar | Power Maverick
    If this post helps, then please consider Accept it as the solution to help the other members.

    RegExpInCanvasApp.gif
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @OOlashyn,

    Thanks for reply, it seems like its component development, if yes can we import piece of component in to canvas apps ..?

     

  • OOlashyn Profile Picture
    3,498 Most Valuable Professional on at

    Hi @Anonymous,

     

    Yes, this is a custom component development. Yes, you can import and use your custom components in Canvas Apps (with some exceptions like using Web Api). 

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