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 / Force number for moder...
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:
I have the same question (0)
  • Verified answer
    SpongYe Profile Picture
    5,909 Super User 2026 Season 1 on at

    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! 🍻

  • iskguy Profile Picture
    402 on at

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

  • Spaceballs Profile Picture
    64 on at

    IsNumeric works better.

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

     

  • fmatamalam Profile Picture
    2 on at

    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
    )
  • esjimenezp Profile Picture
    485 on at

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

     

    Kind regards 👋

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 491

#2
WarrenBelz Profile Picture

WarrenBelz 407 Most Valuable Professional

#3
11manish Profile Picture

11manish 331

Last 30 days Overall leaderboard