Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Force number for modern text input control

(0) ShareShare
ReportReport
Posted on by 402

I know I can set the classic control's TextFormat property, but can this be done using the modern control?  I see the Type is only Text, Search, Password.

 

Thanks for the information and help

Categories:
  • esjimenezp Profile Picture
    485 on at
    Re: Force number for modern text input control

    Thanks for the improvement of the code @fmatamalam and also thank you @SpongYe 

     

    Kind regards 👋

  • fmatamalam Profile Picture
    2 on at
    Re: Force number for modern text input control

    a litle improve:
    (for replicate on multiple input text)

     

    If(!IsMatch(Self.Value;"[0-9]+");
         Notify("Sólo se permiten números!"; NotificationType.Warning);;
         Reset(Self);
         false
    )
  • Spaceballs Profile Picture
    64 on at
    Re: Force number for modern text input control

    IsNumeric works better.

    If(!IsNumeric(Self.Value),
     Notify("Only numbers are allowed", NotificationType.Warning); Reset(TextInputCanvas1)
     
    )

     

  • iskguy Profile Picture
    402 on at
    Re: Force number for modern text input control

    Thank you!  I did forget about IsMatch as I probably do not use it often.  I will assume that IsMatch uses RegEx strings?  

  • Verified answer
    SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on at
    Re: Force number for modern text input control

    Hi @iskguy 

     

    Set on the OnChange the following code:

     

    If(!IsMatch(TextInputCanvas1.Value,"[0-9]+"),
     Notify("Only numbers are allowed", NotificationType.Warning);Reset(TextInputCanvas1),
     false
    )

     

    SpongYe_0-1696857340521.png

     

     If you have any questions or feedback, please let me know. Have a great day! 😊
    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard